/* components.css — wiederverwendbare UI-Bausteine. */

/* — Buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.6rem 1.1rem; border-radius: var(--r-sm);
  font-weight: 600; font-size: var(--text-base); letter-spacing: -0.01em;
  border: 1px solid transparent; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), box-shadow var(--dur-fast), border-color var(--dur-fast);
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn--primary { background: var(--brand); color: white; box-shadow: var(--shadow-sm), inset 0 1px 0 oklch(100% 0 0 / 0.2); }
.btn--primary:hover { background: var(--brand-strong); box-shadow: var(--shadow-md); }
.btn--ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-faint); }
.btn--subtle { background: transparent; color: var(--ink-soft); }
.btn--subtle:hover { background: var(--surface-2); color: var(--ink); }
.btn--block { width: 100%; }
.btn--lg { padding: 0.8rem 1.4rem; font-size: var(--text-md); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--icon { padding: 0.5rem; border-radius: var(--r-sm); }

/* — Surface-Cards — */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card--pad { padding: var(--space-5); }
.card__head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.card__title { font-size: var(--text-md); font-weight: 600; }
.card__title-link { margin-left: auto; font-size: var(--text-sm); color: var(--brand); font-weight: 600; }
.card__title-link:hover { text-decoration: underline; }

/* — Badges / Chips — */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge--ok { background: var(--ok-soft); color: oklch(38% 0.1 152); border-color: transparent; }
.badge--warn { background: var(--warn-soft); color: oklch(46% 0.12 60); border-color: transparent; }
.badge--danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* Akzent-Punkt für Kategorie-Farbcodierung */
.dot { width: 9px; height: 9px; border-radius: var(--r-pill); flex-shrink: 0; background: var(--a, var(--accent-neutral)); }
.swatch { width: 32px; height: 32px; border-radius: var(--r-sm); flex-shrink: 0; display: grid; place-items: center; }
.swatch svg { width: 17px; height: 17px; color: white; }

[data-accent='invoice'] { --a: var(--accent-invoice); }
[data-accent='danger'] { --a: var(--accent-danger); }
[data-accent='contract'] { --a: var(--accent-contract); }
[data-accent='tax'] { --a: var(--accent-tax); }
[data-accent='offer'] { --a: var(--accent-offer); }
[data-accent='delivery'] { --a: var(--accent-delivery); }
[data-accent='bank'] { --a: var(--accent-bank); }
[data-accent='hr'] { --a: var(--accent-hr); }
[data-accent='neutral'] { --a: var(--accent-neutral); }
.swatch[data-accent] { background: color-mix(in oklch, var(--a) 16%, white); }
.swatch[data-accent] svg { color: var(--a); }

/* — Form-Felder — */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-soft); }
.field__hint { font-size: var(--text-xs); color: var(--ink-muted); }
.input, .select, .textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: var(--text-base);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7a86' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 18px; padding-right: 2.4rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* — Segmented Control — */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-sunken); border-radius: var(--r-sm); border: 1px solid var(--line); }
.segmented__btn { padding: 0.35rem 0.85rem; border-radius: 7px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-muted); transition: all var(--dur-fast) var(--ease-out); }
.segmented__btn.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }

/* — Upload-Zone — */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: var(--space-7) var(--space-5);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  text-align: center;
  transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.is-filled { border-style: solid; border-color: var(--ok); background: var(--ok-soft); }
.dropzone__icon { width: 48px; height: 48px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--brand); }
.dropzone__icon svg { width: 24px; height: 24px; }
.dropzone__title { font-weight: 600; }
.dropzone__meta { font-size: var(--text-sm); color: var(--ink-muted); }

/* — Tabelle — */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); }
.table td { padding: var(--space-3); border-bottom: 1px solid var(--line); font-size: var(--text-sm); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--surface-2); }

/* — Switch / Checkbox — */
.check {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; transition: all var(--dur-fast) var(--ease-out);
}
.check svg { width: 14px; height: 14px; color: white; opacity: 0; transform: scale(0.5); transition: all var(--dur-fast) var(--ease-out); }
.check.is-on { background: var(--ok); border-color: var(--ok); }
.check.is-on svg { opacity: 1; transform: none; }

/* — Toast — */
.toast-host { position: fixed; bottom: var(--space-5); right: var(--space-5); z-index: 200; display: flex; flex-direction: column; gap: var(--space-2); }
@media (max-width: 860px) { .toast-host { bottom: calc(72px + var(--space-3)); left: var(--space-4); right: var(--space-4); } }
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); border-radius: var(--r-md);
  background: var(--ink); color: var(--ink-invert);
  box-shadow: var(--shadow-lg); font-size: var(--text-sm); font-weight: 500;
  animation: toastIn var(--dur-normal) var(--ease-out);
}
.toast__icon { width: 22px; height: 22px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--ok); flex-shrink: 0; }
.toast__icon svg { width: 14px; height: 14px; color: white; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }

/* — Empty State — */
.empty { text-align: center; padding: var(--space-7) var(--space-4); color: var(--ink-muted); }
.empty svg { width: 40px; height: 40px; margin: 0 auto var(--space-3); color: var(--ink-faint); }

/* — Progress — */
.bar { height: 7px; border-radius: var(--r-pill); background: var(--surface-sunken); overflow: hidden; }
.bar__fill { height: 100%; border-radius: var(--r-pill); background: var(--brand); transition: width var(--dur-slow) var(--ease-out); }
