/* ============================================================
   Betreuungs-Assistent — style.css
   Design-System für eine juristische Fachanwendung
   Ruhig, vertrauenswürdig, dicht genug für tägliche Fallarbeit.
   Grundlagen: warme Grauskala, Akzent tiefes Petrol, gedeckte
   Semantik, 8px-Raster, dezente Schatten, nur Systemschriften.
   ============================================================ */

/* ---------- 1. Design-Tokens ---------- */
:root{
  --paper:        #f4f3f0;
  --surface:      #ffffff;
  --surface-2:    #faf9f7;
  --surface-3:    #efede9;
  --line:         #e2dfd9;
  --line-strong:  #cfcbc2;

  --ink:          #26241f;
  --ink-2:        #4a463f;
  --ink-3:        #6d675d;
  --ink-faint:    #8d877b;

  --accent:       #175e63;
  --accent-ink:   #114a4e;
  --accent-strong:#0d3d41;
  --accent-soft:  #e4efee;
  --accent-softer:#f1f7f6;
  --accent-line:  #b8d2d0;

  --ok:           #2f6b43;
  --ok-ink:       #275938;
  --ok-soft:      #e8f1e9;
  --ok-line:      #bcd6c2;

  --warn:         #8a5a12;
  --warn-ink:     #6f4a10;
  --warn-soft:    #faf1dd;
  --warn-line:    #e3cf9f;

  --err:          #9c3a30;
  --err-ink:      #832f27;
  --err-soft:     #f8ebe8;
  --err-line:     #e2beb7;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji";
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino,
                Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono",
               Consolas, "Liberation Mono", Menlo, monospace;

  --fs-xs:   0.75rem;
  --fs-sm:   0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md:   1.0625rem;
  --fs-lg:   1.25rem;
  --fs-xl:   1.5625rem;
  --fs-2xl:  1.9375rem;
  --fs-num:  1.75rem;

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --shadow-1: 0 1px 2px rgba(38,36,31,.05);
  --shadow-2: 0 1px 2px rgba(38,36,31,.05), 0 2px 8px rgba(38,36,31,.06);
  --shadow-3: 0 2px 4px rgba(38,36,31,.06), 0 8px 24px rgba(38,36,31,.10);

  --focus-ring: 0 0 0 3px rgba(23,94,99,.22);
  --wrap-max: 68rem;
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body{
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
h1,h2,h3,h4,h5,h6,p,figure,blockquote,dl,dd{ margin: 0; }
ul,ol{ margin: 0; padding: 0; list-style: none; }
img,svg{ display: block; max-width: 100%; }
button,input,select,textarea{ font: inherit; color: inherit; }
fieldset{ border: 0; margin: 0; padding: 0; }
hr{ border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }
a{ color: var(--accent-ink); text-decoration: none; }
a:hover{ text-decoration: underline; text-underline-offset: 2px; }
:focus{ outline: none; }
:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
::selection{ background: var(--accent-soft); color: var(--accent-strong); }
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 3. Typografie ---------- */
h1, h2{
  font-family: var(--font-serif);
  font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; color: var(--ink);
}
h1{ font-size: var(--fs-2xl); margin-bottom: var(--s-4); }
h2{ font-size: var(--fs-xl);  margin-bottom: var(--s-3); }
h3, h4{ font-family: var(--font-sans); font-weight: 600; line-height: 1.3; color: var(--ink); }
h3{ font-size: var(--fs-lg); margin-bottom: var(--s-3); }
h4{ font-size: var(--fs-md); margin-bottom: var(--s-2); }
p{ margin-bottom: var(--s-3); }
p:last-child{ margin-bottom: 0; }
.muted{ color: var(--ink-3); }
.small{ font-size: var(--fs-sm); }
.small.muted, .muted .small{ color: var(--ink-3); }
code, kbd{
  font-family: var(--font-mono); font-size: 0.85em;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 0.1em 0.4em;
}

/* ---------- 4. Topbar ---------- */
.topbar{
  background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-1); position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: var(--s-5);
  padding: 0 var(--s-5); min-height: 3.5rem;
}
.topbar .brand{
  font-family: var(--font-serif); font-size: var(--fs-md); font-weight: 700;
  letter-spacing: 0.01em; color: var(--ink); white-space: nowrap;
  display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0;
}
.topbar .brand::before{
  content: ""; width: 4px; height: 1.375rem; border-radius: 2px;
  background: var(--accent); flex: none;
}
.topbar .brand:hover{ text-decoration: none; }
.topbar nav{
  display: flex; align-items: stretch; gap: var(--s-1);
  align-self: stretch; overflow-x: auto; margin-left: auto;
}
.topbar nav a{
  display: flex; align-items: center; padding: 0 var(--s-3);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2);
  border-bottom: 2px solid transparent; border-top: 2px solid transparent;
  white-space: nowrap; transition: color .12s ease, border-color .12s ease, background-color .12s ease;
}
.topbar nav a:hover{ color: var(--ink); background: var(--surface-2); text-decoration: none; }
.topbar nav a.active, .topbar nav a[aria-current="page"]{
  color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600;
}

/* ---------- 5. Layout ---------- */
.wrap{ max-width: var(--wrap-max); margin: 0 auto; padding: var(--s-6) var(--s-5) var(--s-7); }
.grid{ display: grid; gap: var(--s-4); align-items: start; }
.grid.cols-2{ grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3{ grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 56rem){ .grid.cols-3{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 40rem){
  .wrap{ padding: var(--s-4) var(--s-4) var(--s-6); }
  .grid.cols-2, .grid.cols-3{ grid-template-columns: 1fr; }
}
.row{ display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-end; }
.row > div{ flex: 1 1 12rem; min-width: 0; }

/* ---------- 6. Karten ---------- */
.card{
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  padding: var(--s-5); margin-bottom: var(--s-4);
}
.card > h2:first-child, .card > h3:first-child{
  margin-top: calc(var(--s-1) * -1); padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line); margin-bottom: var(--s-4);
}
.card > :last-child{ margin-bottom: 0; }

/* ---------- 7. Kennzahlen ---------- */
.stat{
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  padding: var(--s-4) var(--s-5); display: flex; flex-direction: column;
  gap: var(--s-1); border-top: 3px solid var(--accent);
}
.stat .n{
  font-size: var(--fs-num); font-weight: 650; line-height: 1.1;
  letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums;
}
.stat .l{ font-size: var(--fs-sm); font-weight: 500; color: var(--ink-3); letter-spacing: 0.01em; }
.stat.due{ border-top-color: var(--err); } .stat.due .n{ color: var(--err-ink); }
.stat.soon{ border-top-color: var(--warn); } .stat.soon .n{ color: var(--warn-ink); }
.stat.ok{ border-top-color: var(--ok); }

/* ---------- 8. Formulare ---------- */
label{
  display: block; font-size: var(--fs-sm); font-weight: 600;
  color: var(--ink-2); margin-bottom: var(--s-1); letter-spacing: 0.01em;
}
input[type="text"], input[type="date"], input[type="password"], input[type="email"],
input[type="number"], input[type="search"], input[type="tel"], input[type="time"],
select, textarea{
  display: block; width: 100%; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3); min-height: 2.5rem;
  box-shadow: inset 0 1px 2px rgba(38,36,31,.04);
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
textarea{ min-height: 6rem; line-height: 1.5; resize: vertical; }
select{
  appearance: none; -webkit-appearance: none; padding-right: var(--s-6);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%234a463f' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' d='M1.5 1.75 6 6.25l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--s-3) center;
}
input:hover, select:hover, textarea:hover{ border-color: var(--ink-faint); }
input:focus, select:focus, textarea:focus{ outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
input:disabled, select:disabled, textarea:disabled{ background: var(--surface-2); color: var(--ink-3); cursor: not-allowed; box-shadow: none; }
input::placeholder, textarea::placeholder{ color: var(--ink-faint); opacity: 1; }
input[type="date"]{ font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"]{ width: 1.0625rem; height: 1.0625rem; accent-color: var(--accent); margin: 0; flex: none; }
.checks{
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); padding: var(--s-3);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
}
.checks label{
  display: inline-flex; align-items: center; gap: var(--s-2); margin: 0;
  font-weight: 500; color: var(--ink); cursor: pointer; padding: var(--s-1) var(--s-2); border-radius: var(--r-sm);
}
.checks label:hover{ background: var(--surface-3); }
.field-auto{ position: relative; }
.field-auto input, .field-auto select, .field-auto textarea{ background: var(--accent-softer); border-color: var(--accent-line); }
.field-auto input:focus, .field-auto select:focus, .field-auto textarea:focus{ border-color: var(--accent); background: var(--surface); }
.field-auto > label{ display: flex; align-items: center; gap: var(--s-2); }
.badge-auto{
  display: inline-flex; align-items: center; gap: 0.3em; font-size: var(--fs-xs);
  font-weight: 600; letter-spacing: 0.02em; color: var(--accent-ink);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: 999px; padding: 0.05rem var(--s-2); line-height: 1.5; white-space: nowrap; vertical-align: middle;
}
.badge-auto::before{
  content: ""; width: 0.75em; height: 0.75em; flex: none;
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23114a4e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2 6.5 4.8 9.2 10 3.2'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ---------- 9. Buttons ---------- */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 2.5rem; padding: var(--s-2) var(--s-4);
  border: 1px solid var(--accent-strong); border-radius: var(--r-md);
  background: var(--accent); color: #ffffff; font-size: var(--fs-sm); font-weight: 600;
  letter-spacing: 0.015em; line-height: 1.2; cursor: pointer; white-space: nowrap;
  text-decoration: none; box-shadow: var(--shadow-1);
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .06s ease;
}
.btn:hover{ background: var(--accent-ink); text-decoration: none; box-shadow: var(--shadow-2); }
.btn:active{ background: var(--accent-strong); transform: translateY(1px); box-shadow: none; }
.btn:focus-visible{ outline: none; box-shadow: var(--shadow-1), var(--focus-ring); }
.btn:disabled, .btn[aria-disabled="true"]{ opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.g{ background: var(--ok); border-color: var(--ok-ink); }
.btn.g:hover{ background: var(--ok-ink); } .btn.g:active{ background: #1f4a2e; }
.btn.r{ background: var(--err); border-color: var(--err-ink); }
.btn.r:hover{ background: var(--err-ink); } .btn.r:active{ background: #6e271f; }
.btn.ghost{ background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); box-shadow: none; }
.btn.ghost:hover{ background: var(--surface-2); border-color: var(--ink-faint); color: var(--ink); box-shadow: none; }
.btn.ghost:active{ background: var(--surface-3); }
.btn.sm{ min-height: 1.875rem; padding: var(--s-1) var(--s-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }

/* ---------- 10. Tabellen ---------- */
table{ width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--surface); }
th{
  text-align: left; font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3); background: var(--surface-2);
  padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
td{ padding: var(--s-3); border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
tbody tr{ transition: background-color .1s ease; }
tbody tr:hover{ background: var(--accent-softer); }
tbody tr:last-child td{ border-bottom: none; }
td.num, th.num{ text-align: right; font-variant-numeric: tabular-nums; }
.card > table{ width: calc(100% + var(--s-5) * 2); margin: 0 calc(var(--s-5) * -1); }
.card > table:last-child{ margin-bottom: calc(var(--s-5) * -1); }
.card > table th:first-child, .card > table td:first-child{ padding-left: var(--s-5); }
.card > table th:last-child, .card > table td:last-child{ padding-right: var(--s-5); }

/* ---------- 11. Tags & Pills ---------- */
.tag{
  display: inline-block; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.02em;
  color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); padding: 0.05rem var(--s-2); line-height: 1.6; white-space: nowrap;
}
.pill{
  display: inline-flex; align-items: center; gap: 0.4em; font-size: var(--fs-xs); font-weight: 650;
  letter-spacing: 0.02em; border-radius: 999px; padding: 0.1rem var(--s-2) 0.1rem 0.5625rem;
  line-height: 1.6; white-space: nowrap; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-strong);
}
.pill::before{ content: ""; width: 0.4375rem; height: 0.4375rem; border-radius: 50%; background: var(--ink-faint); flex: none; }
.pill.due{ color: var(--err-ink); background: var(--err-soft); border-color: var(--err-line); }
.pill.due::before{ background: var(--err); }
.pill.soon{ color: var(--warn-ink); background: var(--warn-soft); border-color: var(--warn-line); }
.pill.soon::before{ background: var(--warn); }
.pill.ok{ color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); }
.pill.ok::before{ background: var(--ok); }

/* ---------- 12. Flash ---------- */
.flash{
  display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--r-md);
  background: var(--surface-2); font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2);
  margin-bottom: var(--s-4); box-shadow: var(--shadow-1);
}
.flash.ok{ background: var(--ok-soft); border-color: var(--ok-line); border-left-color: var(--ok); color: var(--ok-ink); }
.flash.err{ background: var(--err-soft); border-color: var(--err-line); border-left-color: var(--err); color: var(--err-ink); }

/* ---------- 13. Hinweis ---------- */
.hint{
  background: var(--accent-softer); border: 1px solid var(--accent-line); border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4); font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.55; margin: var(--s-3) 0;
}
.hint strong{ color: var(--accent-ink); }
.hint :last-child{ margin-bottom: 0; }

/* ---------- 14. Journal-Einträge ---------- */
.entry{
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4) var(--s-3) calc(var(--s-4) + 3px); margin-bottom: var(--s-3); box-shadow: var(--shadow-1);
}
.entry::before{ content: ""; position: absolute; left: 0; top: var(--s-2); bottom: var(--s-2); width: 3px; border-radius: 2px; background: var(--accent); }
.entry .meta, .entry .small, .entry time{ color: var(--ink-3); font-size: var(--fs-sm); }
.entry h4{ margin-bottom: var(--s-1); }
.entry.warn::before{ background: var(--warn); }
.entry.err::before{ background: var(--err); }
.entry.ok::before{ background: var(--ok); }

/* ---------- 15. Chat ---------- */
.chatbox{
  display: flex; flex-direction: column; gap: var(--s-3); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4);
  max-height: 32rem; overflow-y: auto; scroll-behavior: smooth;
}
.msg{ display: flex; max-width: 100%; }
.msg.u{ justify-content: flex-end; }
.msg.a{ justify-content: flex-start; }
.bubble{ max-width: 78%; padding: var(--s-2) var(--s-3); border-radius: var(--r-lg); font-size: var(--fs-sm); line-height: 1.55; box-shadow: var(--shadow-1); overflow-wrap: break-word; white-space: pre-wrap; }
.msg.u .bubble{ background: var(--accent); color: #ffffff; border-bottom-right-radius: var(--r-sm); }
.msg.u .bubble a{ color: #d9ecea; text-decoration: underline; }
.msg.a .bubble{ background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: var(--r-sm); }

/* ---------- 16. Dropzone ---------- */
.dropzone{
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2);
  text-align: center; padding: var(--s-7) var(--s-5); background: var(--surface);
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg); cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.dropzone:hover, .dropzone:focus-visible{ border-color: var(--accent); background: var(--accent-softer); outline: none; }
.dropzone.dragover{ border-color: var(--accent); border-style: solid; background: var(--accent-soft); box-shadow: inset 0 0 0 3px rgba(23,94,99,.12), var(--shadow-2); }
.dropzone .dz-icon{
  width: 3rem; height: 3rem; margin-bottom: var(--s-2); color: var(--accent);
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--accent-soft); transition: transform .15s ease, background-color .15s ease;
}
.dropzone.dragover .dz-icon, .dropzone:hover .dz-icon{ background: var(--accent); color: #ffffff; transform: translateY(-2px); }
.dropzone .dz-icon:empty::before{
  content: ""; width: 1.5rem; height: 1.5rem; background: currentColor;
  -webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M12 16V5m0 0 4.5 4.5M12 5 7.5 9.5M4 16.5V18a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-1.5'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M12 16V5m0 0 4.5 4.5M12 5 7.5 9.5M4 16.5V18a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-1.5'/%3E%3C/svg%3E") no-repeat center / contain;
}
.dropzone .dz-title{ font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.dropzone .dz-sub{ font-size: var(--fs-sm); color: var(--ink-3); max-width: 34rem; }
.dropzone .dz-sub em, .dropzone .dz-sub b{ font-style: normal; font-weight: 600; color: var(--accent-ink); }

/* ---------- 17. Dokumentliste ---------- */
.doclist{ display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.docitem{ display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); transition: background-color .1s ease; min-width: 0; }
.docitem:last-child{ border-bottom: none; }
.docitem:hover{ background: var(--accent-softer); }
.docitem .doc-icon{
  flex: none; width: 2.25rem; height: 2.25rem; border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
}
.docitem .doc-name, .docitem .name{ flex: 1 1 auto; min-width: 0; font-size: var(--fs-sm); font-weight: 550; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docitem .doc-meta, .docitem .meta{ font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }
.docitem .tag, .docitem .btn.sm{ flex: none; }

/* ---------- 18. Stepbar ---------- */
.stepbar{ display: flex; align-items: flex-start; gap: 0; counter-reset: step; margin-bottom: var(--s-5); }
.stepbar .step{
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  position: relative; text-align: center; font-size: var(--fs-sm); font-weight: 550;
  color: var(--ink-3); padding: 0 var(--s-2); counter-increment: step;
}
.stepbar .step:not(:first-child)::after{
  content: ""; position: absolute; top: 0.875rem; right: calc(50% + 1.25rem); left: calc(-50% + 1.25rem);
  height: 2px; background: var(--line-strong); border-radius: 1px;
}
.stepbar .step.done:not(:first-child)::after, .stepbar .step.active:not(:first-child)::after{ background: var(--accent); }
.stepbar .step::before{
  content: counter(step); width: 1.75rem; height: 1.75rem; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); color: var(--ink-3);
  font-size: var(--fs-sm); font-weight: 650; position: relative; z-index: 1;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.stepbar .step.active{ color: var(--accent-ink); font-weight: 650; }
.stepbar .step.active::before{ border-color: var(--accent); background: var(--accent); color: #ffffff; box-shadow: 0 0 0 4px var(--accent-soft); }
.stepbar .step.done{ color: var(--ink-2); }
.stepbar .step.done::before{ content: "✓"; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- 19. Login ---------- */
.login{
  max-width: 24rem; margin: var(--s-8) auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: var(--s-6) var(--s-6) var(--s-5); border-top: 3px solid var(--accent);
}
.login h1, .login h2{ font-size: var(--fs-xl); text-align: center; margin-bottom: var(--s-2); }
.login p.muted, .login .small{ text-align: center; margin-bottom: var(--s-4); }
.login label{ margin-top: var(--s-3); }
.login .btn{ width: 100%; margin-top: var(--s-4); }
@media (max-width: 30rem){ .login{ margin: var(--s-5) var(--s-4); padding: var(--s-5); } }

/* ---------- 20. Fußzeile ---------- */
.foot{
  max-width: var(--wrap-max); margin: 0 auto; padding: var(--s-4) var(--s-5) var(--s-6);
  border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-faint);
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); align-items: center; justify-content: center;
}
.foot a{ color: var(--ink-3); }

/* ---------- 21. Hilfsklassen ---------- */
.flex-between{ display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.text-right{ text-align: right; }
.nowrap{ white-space: nowrap; }
.rec{ width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--err); display: inline-block; vertical-align: middle; margin-right: var(--s-1); }
.rec.off{ background: var(--ink-faint); }
.visually-hidden{ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 22. Druck ---------- */
@media print{
  .topbar, .foot, .btn, .dropzone, .chatbox{ display: none !important; }
  body{ background: #ffffff; color: #000000; }
  .card, .entry, .stat, .login{ box-shadow: none; border-color: #bbbbbb; break-inside: avoid; }
  .wrap{ padding: 0; max-width: none; }
  a{ color: inherit; text-decoration: underline; }
}
