/* Bausteine: Button, Badge, Auswahl, Feld, Karte, Tabelle, Dialog, Toast, Handy, Marken, Avatar. */

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--space-10);
  padding: 0 var(--space-4);
  border: var(--stroke-hairline) solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  font-size: var(--body-size);
  line-height: 1;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--easing-out), border-color var(--duration-fast) var(--easing-out), color var(--duration-fast) var(--easing-out);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: var(--opacity-disabled); cursor: not-allowed; transform: none; }
.btn--klein { min-height: var(--space-8); padding: 0 var(--space-3); }
.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover:not(:disabled) { background: var(--brand-strong); }
.btn--secondary { background: var(--surface-raised); border-color: var(--border-strong); color: var(--ink); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-hover); }
.btn--dashed { background: var(--surface-raised); border: var(--stroke-hairline) dashed var(--border-strong); color: var(--ink-muted); }
.btn--dashed:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); }
.btn--text { color: var(--brand-ink); }
.btn--text:hover:not(:disabled) { background: var(--brand-soft); }
.btn--danger-text { color: var(--danger); }
.btn--danger-text:hover:not(:disabled) { background: var(--danger-soft); }
.btn--danger { background: var(--danger); color: var(--on-danger); }
.btn--danger:hover:not(:disabled) { opacity: 0.9; }
.btn--on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.btn--icon { width: var(--space-10); padding: 0; }
.btn--icon.btn--klein { width: var(--space-8); }
.btn--breit { width: 100%; }
/* Fingerziel 44 px auch bei kleinen Knöpfen: unsichtbare Trefferfläche */
.btn--klein { position: relative; }
.btn--klein::after { content: ""; position: absolute; inset: -6px -2px; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  background: var(--surface-raised);
  border: var(--stroke-hairline) solid var(--border-strong);
  color: var(--ink-muted);
  font-size: var(--label-size);
  line-height: 1;
  font-weight: 600;
  letter-spacing: var(--label-spacing);
  white-space: nowrap;
}
.badge .icon { width: 16px; height: 16px; }
.badge--zaehler { border: 0; background: none; padding: 0; min-height: 16px; font-weight: 400; font-size: var(--body-sm-size); line-height: 16px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.badge--brand { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.badge--warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-ink); }
.badge--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.badge--success { background: var(--success-soft); border-color: transparent; color: var(--success); }

/* ---------- Auswahl (radiogroup-Schiene) ---------- */
.auswahl {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--surface);
  border: var(--stroke-hairline) solid var(--border);
  border-radius: var(--radius-lg);
}
.auswahl--senkrecht { flex-direction: column; }
.auswahl--auf-grund { background: var(--surface-raised); }
.auswahl__pille {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--space-11);
  padding: 0 var(--space-3);
  border: var(--stroke-hairline) solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-muted);
  font-size: var(--label-size);
  line-height: 16px;
  font-weight: 600;
  letter-spacing: var(--label-spacing);
  text-align: center;
  transition: background var(--duration-fast) var(--easing-out), color var(--duration-fast) var(--easing-out);
}
.auswahl__pille:hover { background: var(--surface-hover); color: var(--ink); }
.auswahl__pille[aria-checked="true"] { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }
.auswahl__pille:disabled { opacity: var(--opacity-disabled); cursor: not-allowed; }
.auswahl__spur { width: 20px; height: 20px; flex: none; display: inline-grid; place-items: center; }
.auswahl__spur { position: relative; }
.auswahl__pille:not([aria-checked="true"]) .auswahl__haken { visibility: hidden; }
/* Ruhende Möglichkeit: leerer Ring in der Spur des Hakens, damit erkennbar ist, dass hier gewählt werden kann */
.auswahl__ring { position: absolute; inset: 2px; border-radius: var(--radius-full); border: 1.5px solid var(--border-strong); }
.auswahl__pille[aria-checked="true"] .auswahl__ring { visibility: hidden; }
.auswahl__pille:hover .auswahl__ring { border-color: var(--ink-muted); }
.auswahl--gestapelt .auswahl__pille { flex-direction: column; gap: var(--space-1); padding: var(--space-2) var(--space-2); min-height: var(--space-15); }
.auswahl--gestapelt .auswahl__text { align-items: center; text-align: center; }
.auswahl--gestapelt .auswahl__pille > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.auswahl__text { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; }
.auswahl__unter { font-size: var(--body-sm-size); line-height: 16px; font-weight: 400; letter-spacing: 0; color: var(--ink-subtle); }
.auswahl__pille[aria-checked="true"] .auswahl__unter { color: var(--brand-ink); }

/* ---------- Feld ---------- */
.feld { display: flex; flex-direction: column; gap: var(--space-2); }
.feld + .feld { margin-top: var(--space-4); }
.feld__label { font-size: var(--label-size); line-height: var(--label-line); font-weight: 600; letter-spacing: var(--label-spacing); }
.feld__eingabe {
  width: 100%;
  min-height: var(--space-10);
  padding: 0 var(--space-3);
  background: var(--surface-raised);
  color: var(--ink);
  border: var(--stroke-hairline) solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: var(--body-size);
  line-height: var(--body-line);
}
.feld__eingabe:hover { border-color: var(--ink); }
.feld__eingabe:focus-visible { border-color: var(--brand-line); outline: 2px solid var(--focus-ring); outline-offset: 2px; }
textarea.feld__eingabe { padding: var(--space-2) var(--space-3); min-height: 96px; resize: vertical; }
select.feld__eingabe { padding-right: var(--space-3); }
.feld__hilfe { font-size: var(--body-sm-size); line-height: var(--body-sm-line); color: var(--ink-muted); }
.feld__fehler { display: flex; gap: var(--space-1); align-items: flex-start; font-size: var(--body-sm-size); line-height: var(--body-sm-line); color: var(--danger); }
.feld--fehler .feld__eingabe { border-color: var(--danger); }
.feld__eingabe:disabled { background: var(--surface-hover); color: var(--ink-subtle); opacity: var(--opacity-disabled); }
.feld__zaehler { align-self: flex-end; }
.versteckt-feld { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Karte ---------- */
.karte {
  background: var(--surface-raised);
  border: var(--stroke-hairline) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.karte--kopf { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.karte__titel { font-size: var(--title-md-size); line-height: var(--title-md-line); font-weight: 600; }
.raster { display: grid; gap: var(--space-4); }
.zeile { display: flex; align-items: center; gap: var(--space-2); }
.zeile--zwischen { justify-content: space-between; }
.zeile--umbruch { flex-wrap: wrap; }
.stapel { display: flex; flex-direction: column; gap: var(--space-3); }
.stapel--klein { gap: var(--space-2); }
.stapel--gross { gap: var(--space-6); }

/* ---------- Tabelle ---------- */
.tabelle { width: 100%; font-size: var(--body-sm-size); line-height: var(--body-sm-line); }
.tabelle th {
  text-align: left;
  font-size: var(--label-size);
  line-height: var(--label-line);
  font-weight: 600;
  letter-spacing: var(--label-spacing);
  color: var(--ink-muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--stroke-hairline) solid var(--border-strong);
}
.tabelle td { padding: var(--space-2) var(--space-3); border-bottom: var(--stroke-hairline) solid var(--border); vertical-align: middle; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; }
.tabelle-huelle { overflow-x: auto; border: var(--stroke-hairline) solid var(--border); border-radius: var(--radius-lg); background: var(--surface-raised); }

/* ---------- Dialog ---------- */
.dialog {
  width: min(420px, calc(100vw - var(--space-8)));
  max-width: none;
  padding: var(--space-5);
  background: var(--surface-overlay);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: var(--scrim); }
.dialog--breit { width: min(640px, calc(100vw - var(--space-8))); }
.dialog__titel { font-family: var(--font-display); font-size: var(--display-md-size); line-height: var(--display-md-line); font-weight: 600; letter-spacing: var(--display-md-spacing); margin-bottom: var(--space-3); }
.dialog__text { color: var(--ink-muted); }
.dialog__aktionen { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-5); }
@media (max-width: 600px) {
  .dialog { width: 100vw; margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: calc(100vw - var(--space-8));
  padding: var(--space-3) var(--space-5);
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  font-size: var(--title-md-size);
  line-height: var(--title-md-line);
  font-weight: 600;
  transform: translate(-50%, 8px);
  opacity: 0;
  transition: opacity var(--duration-mid) var(--easing-out), transform var(--duration-mid) var(--easing-out);
}
.toast--sichtbar { transform: translate(-50%, 0); opacity: 1; }
.toast__aktion {
  background: none; border: 0; padding: 0;
  min-height: var(--space-8);
  color: var(--brand-soft);
  font-weight: 600;
  text-decoration: none;
}
.toast__aktion:hover { text-decoration: underline; }

/* ---------- Marken: erledigt / schlägt vor / informiert ---------- */
.marke {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 26px;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--label-size);
  line-height: 18px;
  font-weight: 600;
  letter-spacing: var(--label-spacing);
}
.marke .icon { width: 16px; height: 16px; }
.marke--erledigt { background: var(--success-soft); color: var(--success); }
.marke--vorschlag { background: var(--warn-soft); color: var(--warn-ink); border: var(--stroke-hairline) dashed var(--warn-ink); }
.marke--informiert { background: var(--brand-soft); color: var(--brand-ink); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: var(--label-size);
  font-weight: 600;
  line-height: 1;
}
.avatar--gross { width: 44px; height: 44px; }
.avatar--warn { background: var(--warn-soft); color: var(--warn-ink); }
.avatar--grau { background: var(--surface-hover); color: var(--ink-muted); }

/* ---------- Leerer Zustand ---------- */
.leer {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4);
  color: var(--ink-muted);
}
.leer .icon { width: 24px; height: 24px; color: var(--ink-subtle); }
.leer__titel { font-size: var(--title-md-size); line-height: var(--title-md-line); font-weight: 600; color: var(--ink); }

/* ---------- Handy-Rahmen ---------- */
.handy {
  width: 390px;
  max-width: 100%;
  height: 780px;
  max-height: calc(100vh - var(--space-8));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.handy__status {
  display: flex; align-items: center; justify-content: space-between;
  flex: none;
  height: var(--space-6);
  padding: 0 var(--space-5);
  background: var(--surface-raised);
  font-size: var(--mono-xs-size);
  line-height: var(--mono-xs-line);
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink-muted);
}
.handy__inhalt { flex: 1; overflow-y: auto; padding: var(--space-4); }
.handy__kopf {
  flex: none;
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-raised);
  border-bottom: var(--stroke-hairline) solid var(--border);
}
@media (max-width: 480px) {
  .handy { width: 100%; height: auto; max-height: none; border: 0; border-radius: 0; box-shadow: none; background: transparent; overflow: visible; }
  .handy__status { display: none; }
  .handy__inhalt { overflow: visible; padding: 0; }
  .handy__kopf { border: var(--stroke-hairline) solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

.auswahl--senkrecht .auswahl__pille { justify-content: flex-start; }
