/* fireplanning button system (Trello pl2Fqjjf 6/6), modelled on firepost public/css/fp-button.css
   (Trello TgsqpfXe, target page docs/buttons/soll.html). Loaded as the last stylesheet on index,
   admin and login. Built on the tokens from steps 1–4: colours from tokens.css, font sizes --fs-*,
   no z-index needed.

   6a (this state): the --btn-* tokens and the system classes. Existing buttons keep their own
   rules (header.css .btn/.btn-primary/.btn-soft/.btn-danger-text, admin-*-btn, app-dialog-btn,
   icon buttons …) but use the --btn-* tokens wherever the value is identical. Moving them onto the
   classes below changes how they look (height, weight, radius) and is 6b, after füürio decides.

   Use: <button class="btn btn--primary">, plus --sm / --block / --pill as needed.
   Icon: btn btn--icon (+ btn--primary / btn--muted). Overlay: btn btn--overlay. Chip: btn btn--chip.
   States: :hover/.is-hover, :focus-visible/.is-focus, :active/.is-pressed,
   [aria-pressed="true"]/.is-on, :disabled/.is-disabled, .is-loading. */
:root {
  /* Sizes (as in firepost) */
  --btn-h: 44px;
  --btn-h-sm: 36px;
  --btn-h-chip: 28px;
  --btn-icon: 36px;
  --btn-icon-touch: 44px;
  --btn-overlay: 32px;
  --btn-pad-x: 18px;
  --btn-pad-x-sm: 12px;
  --btn-pad-x-chip: 10px;
  --btn-gap: 6px;
  /* Shapes */
  --btn-radius: var(--radius-sm);
  --btn-radius-icon: 11px;
  --btn-radius-pill: 999px;
  /* Type (--fs-* scale from step 4) */
  --btn-font-size: var(--fs-14);
  --btn-font-size-sm: var(--fs-13);
  --btn-font-size-chip: var(--fs-12);
  --btn-font-weight: 600;
  /* Colours, only tokens from tokens.css */
  --btn-primary: var(--primary);
  --btn-primary-hover: var(--primary-hover);
  --btn-on-primary: var(--white);
  --btn-neutral: var(--surface-3);
  --btn-neutral-hover: var(--surface-hover);
  --btn-soft: var(--surface-2);
  --btn-text: var(--text);
  --btn-text-muted: var(--text-muted);
  --btn-border: var(--border-strong);
  --btn-danger: var(--danger);
  --btn-danger-bg: var(--danger-bg);
  --btn-success: var(--confirm);
  --btn-on-light: var(--ink);
  --btn-on: var(--primary-muted);
  --btn-focus: var(--fp-focus);
  --btn-tint: color-mix(in srgb, var(--text) 8%, transparent);
  --btn-tint-strong: color-mix(in srgb, var(--text) 14%, transparent);
  --btn-disabled-opacity: 0.4;
}

/* Base: one definition for all system buttons */
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon, .btn--overlay, .btn--chip) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--btn-gap);
  box-sizing: border-box;
  height: var(--btn-h);
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0 var(--btn-pad-x);
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  font-family: inherit;
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  color: var(--btn-text);
  box-shadow: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon, .btn--overlay, .btn--chip)[hidden] { display: none; }
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--chip) .material-symbols-outlined { font-size: var(--fs-18); }

/* Variants */
.btn:where(.btn--primary) { background: var(--btn-primary); color: var(--btn-on-primary); }
.btn:where(.btn--secondary) { border-color: var(--btn-border); background: var(--btn-soft); color: var(--btn-text); }
.btn:where(.btn--ghost) { color: var(--btn-text); }
/* Danger as an outlined button; filled only as the primary action in a confirm dialog (.btn--solid) */
.btn:where(.btn--danger) { border-color: color-mix(in srgb, var(--btn-danger) 35%, transparent); background: var(--btn-danger-bg); color: var(--btn-danger); --btn-spin: var(--btn-danger); }
.btn:where(.btn--danger.btn--solid) { border-color: transparent; background: var(--btn-danger); color: var(--btn-on-light); --btn-spin: var(--btn-on-light); }
.btn:where(.btn--success) { background: var(--btn-success); color: var(--btn-on-light); --btn-spin: var(--btn-on-light); }

/* Sizes and shapes */
.btn:where(.btn--sm) { height: var(--btn-h-sm); padding: 0 var(--btn-pad-x-sm); font-size: var(--btn-font-size-sm); }
.btn:where(.btn--block) { width: 100%; }
.btn:where(.btn--pill) { border-radius: var(--btn-radius-pill); }
/* Chip: filter, switch. 28 px pill; ::before extends the hit area over the row's padding */
.btn:where(.btn--chip) { position: relative; height: var(--btn-h-chip); padding: 0 var(--btn-pad-x-chip); border-color: var(--btn-border); font-size: var(--btn-font-size-chip); border-radius: var(--btn-radius-pill); }
.btn:where(.btn--chip)::before { content: ""; position: absolute; inset: -8px -2px; }

/* Hover */
.btn:where(.btn--primary):hover, .btn:where(.btn--primary).is-hover { background: var(--btn-primary-hover); color: var(--btn-on-primary); }
.btn:where(.btn--secondary):hover, .btn:where(.btn--secondary).is-hover { background: var(--btn-neutral); }
.btn:where(.btn--ghost):hover, .btn:where(.btn--ghost).is-hover, .btn:where(.btn--chip):hover, .btn:where(.btn--chip).is-hover { background: var(--btn-tint); }
.btn:where(.btn--danger):hover, .btn:where(.btn--danger).is-hover { background: color-mix(in srgb, var(--btn-danger) 20%, transparent); }
.btn:where(.btn--danger.btn--solid):hover, .btn:where(.btn--danger.btn--solid).is-hover { background: color-mix(in srgb, var(--btn-danger) 85%, var(--white)); }
.btn:where(.btn--success):hover, .btn:where(.btn--success).is-hover { background: color-mix(in srgb, var(--btn-success) 85%, var(--white)); }

/* Focus (keyboard only) */
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon, .btn--overlay, .btn--chip):focus { outline: none; }
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon, .btn--overlay, .btn--chip):is(:focus-visible, .is-focus) { outline: 2px solid var(--btn-focus); outline-offset: 2px; }

/* Pressed */
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon, .btn--overlay, .btn--chip):is(:active, .is-pressed) { transform: scale(0.97); }
.btn:where(.btn--secondary, .btn--ghost, .btn--chip):is(:active, .is-pressed) { background: var(--btn-tint-strong); }

/* On (toggle, filter, tab): secondary, ghost, icon, chip */
.btn:where(.btn--secondary, .btn--ghost, .btn--icon, .btn--chip):is([aria-pressed="true"], .is-on) { background: var(--btn-on); border-color: var(--btn-primary); color: var(--btn-text); }

/* Disabled */
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon, .btn--overlay, .btn--chip):is(:disabled, .is-disabled) { opacity: var(--btn-disabled-opacity); cursor: not-allowed; transform: none; pointer-events: none; }

/* Loading: text hidden, width kept, spinner */
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon).is-loading { position: relative; color: transparent; pointer-events: none; }
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon).is-loading .material-symbols-outlined { visibility: hidden; }
.btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success, .btn--icon).is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--btn-spin, var(--btn-on-primary));
  border-right-color: transparent;
  animation: fp-btn-spin 0.7s linear infinite;
}
.btn:where(.btn--secondary, .btn--ghost, .btn--icon).is-loading { --btn-spin: var(--btn-text); }
@keyframes fp-btn-spin { to { transform: rotate(360deg); } }

/* Icon buttons: one shape, 36 px visible; 44 px hit area on touch */
.btn:where(.btn--icon) { width: var(--btn-icon); height: var(--btn-icon); padding: 0; border-radius: var(--btn-radius-icon); color: var(--btn-text); }
.btn:where(.btn--icon) .material-symbols-outlined { font-size: var(--fs-20); }
.btn:where(.btn--icon.btn--muted) { color: var(--btn-text-muted); }
.btn:where(.btn--icon):hover, .btn:where(.btn--icon).is-hover { background: var(--btn-tint); }
.btn:where(.btn--icon.btn--primary) { background: var(--btn-primary); color: var(--btn-on-primary); }
.btn:where(.btn--icon.btn--primary):hover, .btn:where(.btn--icon.btn--primary).is-hover { background: var(--btn-primary-hover); }
@media (pointer: coarse) {
  .btn:where(.btn--icon) { width: var(--btn-icon-touch); height: var(--btn-icon-touch); }
  .btn:where(.btn--primary, .btn--secondary, .btn--ghost, .btn--danger, .btn--success) { min-height: var(--btn-icon-touch); }
  .btn:where(.btn--sm) { min-height: var(--btn-h-sm); }
  .btn:where(.btn--chip) { min-height: var(--btn-h-chip); }
}

/* Image overlay: round, light background, always the same size */
.btn:where(.btn--overlay) { width: var(--btn-overlay); height: var(--btn-overlay); padding: 0; border-radius: 50%; background: color-mix(in srgb, var(--white) 92%, transparent); color: var(--text-on-light); box-shadow: var(--shadow-sm); }
.btn:where(.btn--overlay) .material-symbols-outlined { font-size: var(--fs-16); }
.btn:where(.btn--overlay):hover, .btn:where(.btn--overlay).is-hover { background: var(--white); color: var(--btn-primary); }
