/* wtf. (wtfar.eu) Basis-Komponenten – nur Tokens aus tokens.css, keine festen Farben.
   Einbinden nach tokens.css. Klassen mit Präfix w-, damit sie neben bestehendem App-CSS laufen.
   Leitmotiv aus dem Logo: Tinte = ausgewählt (wie die Logo-Kachel), Rot = Aktion, Punkt = Status. */

.w-body {
  margin: 0;
  background: var(--w-bg);
  color: var(--w-text);
  font: var(--w-size-md) / var(--w-leading) var(--w-font);
  -webkit-font-smoothing: antialiased;
}
.w-body *, .w-body *::before, .w-body *::after { box-sizing: border-box; }
/* Browserflächen aus der Palette statt Standard */
.w-body { accent-color: var(--w-accent); caret-color: var(--w-accent); scrollbar-color: var(--w-line-strong) transparent; -webkit-tap-highlight-color: transparent; }
.w-body ::selection { background: color-mix(in srgb, var(--w-brand) 28%, transparent); color: var(--w-text); }
.w-num { font-variant-numeric: tabular-nums; }

/* Überschriften: 800 und eng wie das Logo */
.w-h1, .w-h2, .w-label-caps { margin: 0; }
.w-h1, .w-h2 { font-weight: var(--w-weight-heavy); letter-spacing: var(--w-tracking-tight); line-height: var(--w-leading-tight); text-wrap: balance; margin: 0; }
.w-h1 { font-size: var(--w-size-2xl); }
.w-h2 { font-size: var(--w-size-lg); }
.w-label-caps { font-size: var(--w-size-xs); font-weight: var(--w-weight-semibold); text-transform: uppercase; letter-spacing: var(--w-tracking-caps); color: var(--w-muted); }
.w-muted { color: var(--w-muted); }
.w-small { font-size: var(--w-size-sm); }

/* Logo: immer über <picture> mit Dunkelvariante, Höhe per Klasse */
.w-logo img { display: block; width: auto; height: 20px; }
.w-logo--popup img { height: 18px; }
.w-logo--web img { height: 30px; }

/* Links */
.w-link { color: var(--w-accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.w-link:hover { color: var(--w-accent-hover); }

/* Buttons: primär rot (eine pro Ansicht), sekundär als weiche Fläche, leise als Link */
.w-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--w-space-2);
  min-height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--w-radius);
  background: var(--w-field); color: var(--w-text);
  font: inherit; font-weight: var(--w-weight-semibold); line-height: 1.2; text-decoration: none; white-space: nowrap;
  cursor: pointer; touch-action: manipulation; transition: background-color var(--w-duration), color var(--w-duration), transform var(--w-duration);
}
.w-btn:hover { background: color-mix(in srgb, var(--w-text) 9%, var(--w-field)); }
.w-btn:active { transform: translateY(1px); }
.w-btn--primary { background: var(--w-accent); color: var(--w-on-accent); }
.w-btn--primary:hover { background: var(--w-accent-hover); }
.w-btn--quiet { background: transparent; color: var(--w-accent); padding-inline: 2px; min-height: 28px; }
.w-btn--quiet:hover { background: transparent; color: var(--w-accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.w-btn--small { min-height: 28px; padding: 0 10px; font-size: var(--w-size-sm); }
.w-btn--block { width: 100%; }
.w-btn:disabled, .w-btn[aria-disabled="true"] { opacity: 0.4; cursor: default; pointer-events: none; }

/* Fokus für alles Bedienbare */
.w-btn:focus-visible, .w-chip:focus-visible, .w-tabs button:focus-visible, .w-link:focus-visible {
  outline: 2px solid var(--w-focus); outline-offset: 2px;
}

/* Formulare: weißes Feld auf Papier, Rahmen erst beim Fokus rot */
.w-label { display: block; margin: var(--w-space-3) 0 6px; font-size: var(--w-size-sm); font-weight: var(--w-weight-semibold); }
.w-field {
  width: 100%; min-height: 36px; padding: 7px 10px;
  border: 1px solid var(--w-line-strong); border-radius: var(--w-radius);
  background: var(--w-surface); color: var(--w-text); font: inherit;
  transition: border-color var(--w-duration), box-shadow var(--w-duration);
}
.w-field:hover { border-color: var(--w-muted); }
.w-field:focus-visible { outline: none; border-color: var(--w-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--w-focus) 22%, transparent); }
.w-field::placeholder { color: var(--w-muted); opacity: 1; }
textarea.w-field { resize: vertical; min-height: 72px; }
.w-field[aria-invalid="true"] { border-color: var(--w-error); }
.w-help { margin: 6px 0 0; font-size: var(--w-size-sm); color: var(--w-muted); }
.w-help--error { color: var(--w-error); }

/* Chips: Adresse + Statuspunkt + Statuswort; ausgewählt = Tintenkachel wie das Logo */
.w-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.w-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  min-height: 28px; padding: 0 10px 0 9px; border: 0; border-radius: var(--w-radius-pill);
  background: var(--w-field); color: var(--w-text); font: inherit; font-size: var(--w-size-sm); cursor: pointer; touch-action: manipulation;
  transition: background-color var(--w-duration), color var(--w-duration);
}
.w-chip:hover { background: color-mix(in srgb, var(--w-text) 9%, var(--w-field)); }
.w-chip::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--w-muted); }
.w-chip--found::before { background: var(--w-ok); }
.w-chip--guess::before { background: var(--w-guess); }
.w-chip--pattern::before { background: var(--w-brand); }
.w-chip__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-chip__state { color: var(--w-muted); font-size: var(--w-size-xs); }
.w-chip[aria-pressed="true"] { background: var(--w-text); color: var(--w-bg); }
.w-chip[aria-pressed="true"] .w-chip__state { color: color-mix(in srgb, var(--w-bg) 72%, transparent); }

/* Hinweise: Statuszeile (leise) und Kasten (getönt, mit Statuspunkt) */
.w-status { display: flex; align-items: center; gap: 6px; min-height: 1.5em; margin: var(--w-space-3) 0 0; font-size: var(--w-size-sm); color: var(--w-muted); }
.w-status--ok { color: var(--w-ok); }
.w-status--error { color: var(--w-error); }
.w-notice {
  --w-tone: var(--w-muted);
  position: relative; padding: 10px 12px 10px 28px; border-radius: var(--w-radius);
  background: color-mix(in srgb, var(--w-tone) 9%, var(--w-surface));
  font-size: var(--w-size-sm); line-height: 1.45;
}
.w-notice::before { content: ""; position: absolute; left: 12px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--w-tone); }
.w-notice strong { display: block; font-weight: var(--w-weight-semibold); }
.w-notice--ok { --w-tone: var(--w-ok); }
.w-notice--guess { --w-tone: var(--w-guess); }
.w-notice--error { --w-tone: var(--w-error); }

/* Reiter: Segmentschalter, aktiver Reiter als Tintenfläche */
.w-tabs { display: flex; gap: 2px; margin: 0 0 var(--w-space-4); padding: 3px; border-radius: var(--w-radius); background: var(--w-field); }
.w-tabs button {
  flex: 1; min-height: 30px; padding: 0 10px; border: 0; border-radius: calc(var(--w-radius) - 2px);
  background: none; color: var(--w-muted); font: inherit; font-size: var(--w-size-sm); font-weight: var(--w-weight-semibold); cursor: pointer;
}
.w-tabs button:hover { color: var(--w-text); }
.w-tabs button[aria-selected="true"] { background: var(--w-text); color: var(--w-bg); }

/* Karten und Listen */
.w-card { padding: var(--w-space-3); border-radius: var(--w-radius-lg); background: var(--w-surface); border: 1px solid var(--w-line); }
.w-list { list-style: none; margin: 0; padding: 0; }
.w-list > li { display: flex; align-items: center; gap: var(--w-space-3); padding: 10px 0; }
.w-list > li + li { border-top: 1px solid var(--w-line); }
.w-list__main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.w-list__meta { display: block; font-size: var(--w-size-sm); color: var(--w-muted); }

/* Rahmen der Apps */
.w-popup { width: var(--w-popup-width); padding: var(--w-space-4); font-size: var(--w-size-base); }
.w-taskpane { min-width: var(--w-taskpane-min); padding: var(--w-space-4); }
.w-head { display: flex; align-items: center; justify-content: space-between; gap: var(--w-space-2); margin-bottom: var(--w-space-3); }
.w-actions { display: flex; gap: var(--w-space-2); margin-top: var(--w-space-4); }
.w-actions > .w-btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .w-btn, .w-chip, .w-field { transition: none; }
  .w-btn:active { transform: none; }
}
