/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
body[data-tab="admin"] .btn--primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn--danger { color: var(--short); border-color: var(--short); }
.btn--quiet { border-color: transparent; background: transparent; }
.btn--small { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.btn--block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--check-yellow); }
.icon-btn[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .field__label { font-size: .88rem; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field__error { color: var(--short); font-weight: 600; min-height: 1.2em; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- Umschalter (Segmented) ---------- */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.seg__btn {
  flex: 1; min-height: 42px; padding: 4px 6px; font-size: .94rem; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.seg__btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong), var(--shadow); }
.seg__count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--short); color: #fff; font-size: .74rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Suche ---------- */
.search { position: relative; flex: 1; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 38px; }

/* ---------- Kategorie-Plakette (wie das Schild an der Fachtür) ---------- */
.plate {
  --c: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 32px; padding: 0 8px; border-radius: 6px;
  background: var(--c); color: #fff; font-weight: 800; letter-spacing: .02em; font-size: .95rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
.dot {
  --c: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  border: 1.5px solid var(--c); color: var(--c); font-size: .72rem; font-weight: 800;
}

/* ---------- Gruppen (Fach / Tasche) ---------- */
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.group + .group { margin-top: 10px; }
.group__head {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px;
  background: none; border: 0; text-align: left;
}
.group__head:disabled { cursor: default; }
.group__title { flex: 1; min-width: 0; font-weight: 700; font-size: 1.02rem; line-height: 1.2; }
.group__sub { display: block; font-weight: 500; font-size: .82rem; color: var(--muted); margin-top: 2px; }
.group__meta { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.group__chev { transition: transform .15s; }
.group__head[aria-expanded="true"] .group__chev { transform: rotate(180deg); }
.group__body { border-top: 1px solid var(--line); }
.pill {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 13px;
  font-size: .82rem; font-weight: 700; background: var(--surface-2); color: var(--muted);
}
.pill--short { background: var(--short-soft); color: var(--short); }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--used { background: var(--used-soft); color: var(--used); }

/* ---------- Zeilen ---------- */
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center;
  padding: 12px 14px; border-top: 1px solid var(--line);
}
.group__body > .row:first-child { border-top: 0; }
.row--short { background: var(--short-soft); box-shadow: inset 4px 0 0 var(--short); }
.row--used { background: var(--used-soft); box-shadow: inset 4px 0 0 var(--used); }
.row__main { min-width: 0; }
.row__name { font-weight: 600; overflow-wrap: anywhere; hyphens: auto; }
.row__sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: .88rem; color: var(--muted); }
.row__short { color: var(--short); font-weight: 700; }
.row__used { color: var(--used); font-weight: 700; }
.row__actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Zähler ---------- */
.stepper { display: inline-flex; align-items: center; gap: 2px; }
.stepper__btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--surface); font-size: 1.5rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.stepper__btn:active { background: var(--accent-soft); border-color: var(--accent); }
.stepper__btn:disabled { opacity: .35; }
.stepper__input {
  width: 46px; height: 44px; text-align: center; border: 0; background: transparent;
  font-size: 1.25rem; font-weight: 700; -moz-appearance: textfield;
}
.stepper__input::-webkit-outer-spin-button, .stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Schalter (Checkliste) ---------- */
.switch { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 52px; height: 30px; border-radius: 15px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + .switch__track { background: var(--short); }
.switch input:checked + .switch__track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Leere Zustände ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .icon { width: 44px; height: 44px; color: var(--ok); margin-bottom: 8px; }
.empty__title { font-size: 1.15rem; font-weight: 700; color: var(--ink); margin-bottom: 4px; }

/* ---------- Dialoge ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 16, 22, .55);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.modal {
  width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto;
  background: var(--surface); border-radius: 16px 16px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  animation: modal-in .18s ease-out;
}
.modal__title { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.modal__text { color: var(--muted); margin-bottom: 14px; white-space: pre-line; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
@keyframes modal-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 16px; }
}

/* ---------- Hinweis (Toast) ---------- */
.toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 10px; font-weight: 600; max-width: 440px; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: modal-in .18s ease-out; }
.toast--error { background: var(--short); color: #fff; }
@media (min-width: 900px) { .toast-root { bottom: 24px; } }

/* Zeilen mit „Aufgefüllt“-Knopf: Bedienelemente in eigener Zeile unter dem Namen */
.row--short .row__actions { grid-column: 1 / -1; justify-content: space-between; }
.group__head { color: var(--ink); }
.group__head:disabled { color: var(--ink); opacity: 1; }
.row__dots { display: inline-flex; gap: 4px; }
.cat-picker { display: grid; gap: 4px; margin-bottom: 8px; }
.cat-picker h3 { font-size: .88rem; color: var(--muted); margin: 10px 0 2px; }

.btn { white-space: nowrap; }
.summary .btn { margin-left: auto; }
