/* =========================================================
   base.css — LeapViews v3 : jetons, polices, base, boutons, champs, cases, onglets, tags, étiquettes, mouvement.
   Peau « bleu nuit » (façon 1of10) : fond bleu nuit très profond, cartes un cran plus claires, contours fins bleutés
   discrets, accent bleu vif saturé (texte blanc), boutons en pilule, bouton secondaire blanc plein (.tp-button--white),
   grands titres très gras (800), touches de jaune / corail / menthe. Contraste AA partout.
   Police unique : Plus Jakarta Sans (titres en 700–800, texte en 400–600).
   Interdit : orbes lumineux, texte en dégradé, lueurs colorées, grille de points.

   Vocabulaire (à réutiliser dans les CSS de vues) :
     Boutons   .tp-button (neutre, pilule) + --primary | --white (blanc plein, texte noir) | --subtle (discret) | --danger
               | --danger-subtle | --sun | --mint | --coral
               + --sm | --lg | --block | --start ;  .tp-icon-btn (+ --sm)  ·  .tp-link (+ --muted | --danger)
               État occupé : .tp-button.is-busy (le texte reste, un .tp-spinner peut être ajouté dedans)
     Champs    .tp-field > .tp-field__label + .tp-input | .tp-textarea | .tp-select + .tp-field__hint | .tp-field__error
               .tp-check (label + case/radio) · .tp-seg > .tp-seg__opt > input[type=radio] + span (segments)
               .tp-range · .tp-search (champ avec icône) · .tp-req (astérisque)
               Cases à cocher et boutons radio : stylés et animés partout (classe .tp-native pour garder le rendu natif)
     Onglets   .tp-tabs > .tp-tab[aria-selected=true] (+ .tp-tab__count)
     Tags      .tp-tag.tp-tag--{green|yellow|orange|red|purple|blue|sky|lime|pink|gray} (doux, 20 px) (+ .tp-tag--link)
     Étiquettes .tp-label.tp-label--{couleur} (franche, 8×40 px) ; .is-expanded (16 px + texte) ; .tp-label--lg (32 px)
     Divers    .tp-count · .tp-dot (--c) · .tp-spinner (+ --sm | --lg) · .tp-kbd · .tp-sr · .tp-muted · .tp-display (police titres)
     Mouvement .tp-ani (apparition, --tp-i = rang pour l'échelonnement ; posé par ui.animateIn) · .tp-hover-lift
               @keyframes tp-rise · tp-pop-in · tp-spring-in · tp-fade · tp-pulse · tp-spin · tp-shimmer · tp-float · tp-wiggle
   Jetons
     Surfaces  --tp-bg · --tp-bg-sunken · --tp-surface · --tp-surface-2 · --tp-surface-3(-hover) · --tp-field-bg
               --tp-hover(-strong) · --tp-pressed · --tp-selected
     Traits    --tp-line (contour 1 px, plus sombre que les surfaces) · --tp-border (séparateur fin) · --tp-border-input
     Ombres    --tp-shadow-raised (douce, 1–2 px) · --tp-shadow-pop (douce, courte) · --tp-shadow-pop-lg (survol) · --tp-shadow-overlay
               --tp-drop (couleur des petites ombres franches de 1 px)
     Texte     --tp-text(-strong|-subtle|-subtlest|-disabled)
     Accents   --tp-accent(-hover|-edge|-text) · --tp-sun · --tp-coral · --tp-mint (+ -bg, -text, -edge)
               --tp-danger(-hover|-soft) · --tp-success · --tp-warning
     Formes    --tp-radius-xs 6 · --tp-radius-sm 8 · --tp-radius-md 10 · --tp-radius 12 · --tp-radius-lg 14 · --tp-radius-xl 18
               · --tp-radius-pill 999
     Polices   --tp-font (Plus Jakarta Sans, texte) · --tp-font-display (Plus Jakarta Sans : marque et grands titres) · --tp-font-mono
     Temps     --tp-dur 140ms · --tp-dur-slow 260ms · --tp-ease · --tp-ease-out · --tp-spring (très léger dépassement)
     Palette   --tp-<c>-bg / --tp-<c>-text / --tp-<c> pour green yellow orange red purple blue sky lime pink gray
   ========================================================= */

:root {
  color-scheme: dark;

  /* Surfaces: deep night blue range (near-black page, cards one notch lighter, sidebar a notch darker) */
  --tp-bg: #0b0f17;
  --tp-bg-sunken: #080b12;
  --tp-surface: #131926;
  --tp-surface-2: #171e2c;
  --tp-surface-3: #1e2738;
  --tp-surface-3-hover: #283247;
  --tp-field-bg: #0e131d;
  --tp-hover: #8fb0ff14;
  --tp-hover-strong: #8fb0ff26;
  --tp-pressed: #8fb0ff40;
  --tp-selected: #14234a;

  /* Lines: thin, bluish, discreet */
  --tp-line: #212b3e;
  --tp-border: #9db4e01f;
  --tp-border-input: #2a3550;

  /* Short soft shadows (no colour); --tp-drop = the 1 px edge under buttons */
  --tp-drop: rgba(0, 0, 0, 0.35);
  --tp-shadow-raised: 0 1px 2px rgba(0, 0, 0, 0.4);
  --tp-shadow-pop: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.28);
  --tp-shadow-pop-lg: 0 2px 6px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.42);
  --tp-shadow-overlay: 0 0 0 1px var(--tp-line), 0 4px 12px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.5);

  /* Text */
  --tp-text: #c5cddb;
  --tp-text-strong: #f5f7fb;
  --tp-text-subtle: #a1acc0;
  --tp-text-subtlest: #8592a8;
  --tp-text-disabled: #c7d6f552;

  /* Accents: vivid saturated blue (white text AA); --tp-accent-hover doubles as link / text blue on dark surfaces */
  --tp-accent: #2f62f0;
  --tp-accent-hover: #6b92ff;
  --tp-accent-fill-hover: #3d6ef5;
  --tp-accent-edge: #2a57d4;
  --tp-accent-text: #ffffff;
  --tp-sun: #facc15;
  --tp-sun-edge: #9a6f08;
  --tp-sun-bg: #3d3110;
  --tp-sun-text: #ffd97a;
  --tp-coral: #ff5a4e;
  --tp-coral-edge: #a63c2f;
  --tp-coral-bg: #43201f;
  --tp-coral-text: #ffb2a7;
  --tp-mint: #22d3a0;
  --tp-mint-edge: #1f7f5b;
  --tp-mint-bg: #0f3a2f;
  --tp-mint-text: #9cf0cf;
  --tp-danger: #ef4444;
  --tp-danger-hover: #fd9891;
  --tp-danger-soft: #4f1d1f;
  --tp-success: #22c55e;
  --tp-warning: #facc15;

  /* Shapes: rounder; buttons are pills */
  --tp-radius-xs: 6px;
  --tp-radius-sm: 8px;
  --tp-radius-md: 10px;
  --tp-radius: 12px;
  --tp-radius-lg: 14px;
  --tp-radius-xl: 18px;
  --tp-radius-pill: 999px;

  /* Fonts: self-hosted Plus Jakarta Sans (assets/fonts/fonts.css), system fonts as fallback */
  --tp-font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, "Roboto", "Noto Sans", "Helvetica Neue", sans-serif;
  --tp-font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, "Roboto", sans-serif;
  --tp-font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;

  /* Motion */
  --tp-dur: 140ms;
  --tp-dur-slow: 260ms;
  --tp-ease: cubic-bezier(0.2, 0, 0, 1);
  --tp-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --tp-spring: cubic-bezier(0.3, 1.22, 0.6, 1);

  /* Layout */
  --tp-sidebar-w: 260px;
  --tp-topbar-h: 52px;

  /* Tag / label palette: soft background, soft text, strong colour (kept from v2) */
  --tp-green-bg: #0e5a33;  --tp-green-text: #4ade80;  --tp-green: #22c55e;
  --tp-yellow-bg: #5c4500; --tp-yellow-text: #fde047; --tp-yellow: #facc15;
  --tp-orange-bg: #6b2a00; --tp-orange-text: #fb923c; --tp-orange: #f97316;
  --tp-red-bg: #6b1414;    --tp-red-text: #f87171;    --tp-red: #ef4444;
  --tp-purple-bg: #3b1e7a; --tp-purple-text: #a78bfa; --tp-purple: #8b5cf6;
  --tp-blue-bg: #0b3a8c;   --tp-blue-text: #60a5fa;   --tp-blue: #3b82f6;
  --tp-sky-bg: #044a6b;    --tp-sky-text: #38bdf8;    --tp-sky: #0ea5e9;
  --tp-lime-bg: #3a5a00;   --tp-lime-text: #a3e635;   --tp-lime: #84cc16;
  --tp-pink-bg: #6b1046;   --tp-pink-text: #f472b6;   --tp-pink: #ec4899;
  --tp-gray-bg: #334155;   --tp-gray-text: #e2e8f0;   --tp-gray: #94a3b8;
}

/* ---------- Reset + base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--tp-bg); }
body {
  margin: 0; min-height: 100vh; background: var(--tp-bg); color: var(--tp-text);
  font: 400 14px/20px var(--tp-font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--tp-accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
hr { height: 1px; margin: 12px 0; border: 0; background: var(--tp-border); }
[hidden] { display: none !important; }
::selection { background: #2f62f0; color: #fff; }

h1, h2, h3, h4 { margin: 0; color: var(--tp-text-strong); font-weight: 700; }
h1, h2, .tp-display { font-family: var(--tp-font-display); font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 24px; line-height: 30px; letter-spacing: -0.02em; }
h2 { font-size: 17px; line-height: 22px; }
h3 { font-size: 14px; line-height: 20px; }
h4 { font-size: 12px; line-height: 16px; }
small { font-size: 12px; line-height: 16px; }
strong, b { font-weight: 700; color: var(--tp-text-strong); }
code, kbd, pre { font-family: var(--tp-font-mono); font-size: 12px; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--tp-accent-hover); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: #9db4e033 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #9db4e033; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #9db4e052; }
::-webkit-scrollbar-track { background: transparent; }

.tp-icon { width: 16px; height: 16px; flex: none; }
.tp-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tp-muted { color: var(--tp-text-subtlest); }
.tp-skip {
  position: fixed; left: 8px; top: 8px; z-index: 1000; padding: 6px 12px; border: 1px solid var(--tp-accent-edge); border-radius: var(--tp-radius-sm);
  background: var(--tp-accent); color: var(--tp-accent-text); font-weight: 700; transform: translateY(-200%);
}
.tp-skip:focus { transform: none; text-decoration: none; }
.tp-noscript { max-width: 520px; margin: 64px auto; padding: 0 16px; text-align: center; }
.tp-kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--tp-line); border-radius: var(--tp-radius-xs);
  background: var(--tp-surface-3); color: var(--tp-text-subtle); text-align: center; line-height: 16px; box-shadow: 0 1px 0 var(--tp-drop);
}

/* ---------- Buttons (pressable, light press) ---------- */
.tp-button {
  --tp-btn-bg: var(--tp-surface-3); --tp-btn-bg-hover: var(--tp-surface-3-hover); --tp-btn-fg: var(--tp-text-strong);
  --tp-btn-edge: #2c3850; --tp-btn-shadow: 0 1px 2px rgba(0, 0, 0, 0.28); --tp-btn-shadow-active: none; --tp-btn-press: 1px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 16px;
  border: 1px solid var(--tp-btn-edge); border-radius: var(--tp-radius-pill); background: var(--tp-btn-bg); color: var(--tp-btn-fg);
  box-shadow: var(--tp-btn-shadow);
  font-family: var(--tp-font); font-weight: 700; line-height: 20px; letter-spacing: 0;
  text-align: center; text-decoration: none; white-space: nowrap; vertical-align: middle; user-select: none; -webkit-user-select: none;
  transition: background-color var(--tp-dur) var(--tp-ease), color var(--tp-dur) var(--tp-ease), border-color var(--tp-dur) var(--tp-ease),
    transform 120ms var(--tp-ease), box-shadow 120ms var(--tp-ease);
}
.tp-button:hover { background: var(--tp-btn-bg-hover); color: var(--tp-btn-fg); text-decoration: none; }
.tp-button:active:not(:disabled):not([aria-disabled="true"]) { transform: translateY(var(--tp-btn-press)); box-shadow: var(--tp-btn-shadow-active); }
.tp-button[aria-pressed="true"], .tp-button.is-active { --tp-btn-bg: var(--tp-selected); --tp-btn-bg-hover: #1b2d5c; --tp-btn-fg: var(--tp-accent-hover); --tp-btn-edge: var(--tp-accent-edge); }
.tp-button--primary { --tp-btn-bg: var(--tp-accent); --tp-btn-bg-hover: var(--tp-accent-fill-hover); --tp-btn-fg: var(--tp-accent-text); --tp-btn-edge: var(--tp-accent); }
.tp-button--white { --tp-btn-bg: #ffffff; --tp-btn-bg-hover: #e4e9f4; --tp-btn-fg: #0b0f17; --tp-btn-edge: #ffffff; }
.tp-button--white:hover { --tp-btn-edge: #e4e9f4; }
.tp-button--sun { --tp-btn-bg: var(--tp-sun); --tp-btn-bg-hover: #ffd570; --tp-btn-fg: #2a1f02; --tp-btn-edge: var(--tp-sun-edge); }
.tp-button--mint { --tp-btn-bg: var(--tp-mint); --tp-btn-bg-hover: #7fe5bd; --tp-btn-fg: #06251a; --tp-btn-edge: var(--tp-mint-edge); }
.tp-button--coral { --tp-btn-bg: var(--tp-coral); --tp-btn-bg-hover: #ff9a8c; --tp-btn-fg: #2b0b07; --tp-btn-edge: var(--tp-coral-edge); }
.tp-button--danger { --tp-btn-bg: var(--tp-danger); --tp-btn-bg-hover: var(--tp-danger-hover); --tp-btn-fg: #2b0b07; --tp-btn-edge: #9e3a33; }
.tp-button--subtle, .tp-button--ghost, .tp-button--danger-subtle {
  --tp-btn-bg: transparent; --tp-btn-bg-hover: var(--tp-hover); --tp-btn-fg: var(--tp-text); --tp-btn-edge: transparent;
  --tp-btn-shadow: none !important; --tp-btn-shadow-active: none; --tp-btn-press: 1px;
}
.tp-button--subtle:hover, .tp-button--ghost:hover { --tp-btn-fg: var(--tp-text-strong); }
.tp-button--subtle:active:not(:disabled), .tp-button--ghost:active:not(:disabled), .tp-button--danger-subtle:active:not(:disabled) { background: var(--tp-hover-strong); }
.tp-button--danger-subtle { --tp-btn-fg: var(--tp-danger); }
.tp-button--danger-subtle:hover { --tp-btn-bg-hover: var(--tp-danger-soft); --tp-btn-fg: var(--tp-danger-hover); }
.tp-button:disabled, .tp-button[aria-disabled="true"] {
  --tp-btn-bg: var(--tp-surface-2); --tp-btn-bg-hover: var(--tp-surface-2); --tp-btn-fg: var(--tp-text-disabled); --tp-btn-edge: var(--tp-line);
  box-shadow: none; transform: none;
}
.tp-button--subtle:disabled, .tp-button--ghost:disabled, .tp-button--danger-subtle:disabled { --tp-btn-bg: transparent; --tp-btn-bg-hover: transparent; --tp-btn-edge: transparent; }
.tp-button.is-busy { cursor: progress; }
.tp-button.is-busy .tp-spinner { width: 14px; height: 14px; border-width: 2px; border-color: currentColor; border-top-color: transparent; opacity: 0.85; }
.tp-button--sm { --tp-btn-shadow: 0 1px 0 var(--tp-drop); --tp-btn-press: 1px; min-height: 26px; padding: 2px 11px; font-size: 12px; line-height: 16px; gap: 4px; }
.tp-button--sm .tp-icon { width: 14px; height: 14px; }
.tp-button--lg { --tp-btn-shadow: 0 1px 0 var(--tp-drop), 0 2px 6px rgba(0, 0, 0, 0.22); --tp-btn-press: 1px; min-height: 44px; padding: 10px 22px; font-size: 15px; }
.tp-button--block { display: flex; width: 100%; }
.tp-button--start { justify-content: flex-start; border-radius: var(--tp-radius-md); }

.tp-icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0; border: 0;
  border-radius: var(--tp-radius-md); background: transparent; color: var(--tp-text-subtle);
  transition: background-color var(--tp-dur) var(--tp-ease), color var(--tp-dur) var(--tp-ease), transform 160ms var(--tp-ease);
}
.tp-icon-btn:hover { background: var(--tp-hover); color: var(--tp-text-strong); text-decoration: none; }
.tp-icon-btn:active { background: var(--tp-hover-strong); transform: scale(0.94); }
.tp-icon-btn[aria-pressed="true"] { color: var(--tp-accent); }
.tp-icon-btn--sm { width: 26px; height: 26px; border-radius: var(--tp-radius-sm); }
.tp-icon-btn--sm .tp-icon { width: 14px; height: 14px; }

.tp-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  color: var(--tp-accent-hover); font-weight: 700; text-decoration: none;
}
.tp-link:hover { color: #a9c0ff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.tp-link--muted { color: var(--tp-text-subtle); }
.tp-link--danger { color: var(--tp-danger); }

/* ---------- Fields ---------- */
.tp-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tp-field + .tp-field { margin-top: 12px; }
.tp-field__label { color: var(--tp-text-subtle); font-size: 12px; line-height: 16px; font-weight: 700; }
.tp-field__hint { color: var(--tp-text-subtlest); font-size: 12px; line-height: 16px; }
.tp-field__hint .tp-icon { display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: -1px; }
.tp-field__error { display: flex; align-items: flex-start; gap: 4px; color: var(--tp-danger-hover); font-size: 12px; line-height: 16px; font-weight: 600; }
.tp-field__error .tp-icon { width: 14px; height: 14px; margin-top: 1px; }
.tp-req { color: var(--tp-coral); }

.tp-input, .tp-textarea, .tp-select {
  display: block; width: 100%; min-height: 38px; padding: 8px 13px; border: 1px solid var(--tp-border-input);
  border-radius: var(--tp-radius-md); background: var(--tp-field-bg); color: var(--tp-text-strong);
  line-height: 20px; transition: border-color var(--tp-dur) var(--tp-ease), box-shadow var(--tp-dur) var(--tp-ease), background-color var(--tp-dur) var(--tp-ease);
}
.tp-input::placeholder, .tp-textarea::placeholder { color: var(--tp-text-subtlest); opacity: 1; }
.tp-input:hover, .tp-textarea:hover, .tp-select:hover { border-color: #3a4866; }
.tp-input:focus, .tp-textarea:focus, .tp-select:focus { border-color: var(--tp-accent); box-shadow: 0 0 0 1px var(--tp-accent); outline: none; background: #101624; }
.tp-input[aria-invalid="true"], .tp-textarea[aria-invalid="true"], .tp-select[aria-invalid="true"] { border-color: var(--tp-danger); }
.tp-input:disabled, .tp-textarea:disabled, .tp-select:disabled { opacity: 0.6; cursor: not-allowed; }
.tp-input--sm, .tp-select--sm { min-height: 30px; padding: 4px 10px; border-radius: var(--tp-radius-sm); font-size: 13px; }
.tp-textarea { min-height: 80px; resize: vertical; }
.tp-select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1acc0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.tp-select option { background: var(--tp-surface-2); color: var(--tp-text); }
input[type="search"]::-webkit-search-cancel-button { filter: invert(0.7); }

.tp-search { position: relative; display: flex; align-items: center; min-width: 0; }
.tp-search > .tp-icon { position: absolute; left: 12px; color: var(--tp-text-subtlest); pointer-events: none; }
.tp-search > .tp-input { padding-left: 36px; }

/* Checkboxes and radios: chunky, animated (zero specificity so view rules can still size them) */
:where(input[type="checkbox"], input[type="radio"]):not(.tp-native) {
  appearance: none; -webkit-appearance: none; display: inline-block; width: 18px; height: 18px; margin: 0; flex: none; vertical-align: middle;
  border: 1.5px solid #4f5d78; border-radius: 5px; background: var(--tp-field-bg) no-repeat center / 0 0; cursor: pointer;
  transition: background-color 140ms var(--tp-ease), border-color 140ms var(--tp-ease), background-size 220ms var(--tp-spring), transform 160ms var(--tp-spring);
}
:where(input[type="radio"]):not(.tp-native) { border-radius: 50%; }
:where(input[type="checkbox"], input[type="radio"]):not(.tp-native):hover { border-color: var(--tp-accent-hover); }
:where(input[type="checkbox"], input[type="radio"]):not(.tp-native):active { transform: scale(0.92); }
:where(input[type="checkbox"]):not(.tp-native):checked {
  border-color: var(--tp-accent-edge); background-color: var(--tp-accent); background-size: 78% 78%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f1a2a' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
:where(input[type="radio"]):not(.tp-native):checked {
  border-color: var(--tp-accent); background-size: 60% 60%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='5' fill='%236b92ff'/%3E%3C/svg%3E");
}
:where(input[type="checkbox"], input[type="radio"]):not(.tp-native):disabled { opacity: 0.5; cursor: not-allowed; }
:where(input[type="checkbox"], input[type="radio"]):not(.tp-native):focus-visible { outline: 2px solid var(--tp-accent-hover); outline-offset: 2px; }
input.tp-native { accent-color: var(--tp-accent); }

.tp-check { display: flex; align-items: center; gap: 8px; min-height: 28px; cursor: pointer; color: var(--tp-text); }
.tp-check input { margin: 0; flex: none; cursor: pointer; }
.tp-range { width: 100%; accent-color: var(--tp-accent); }

/* Segmented choice (radio group) */
.tp-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-seg__opt { position: relative; display: inline-flex; }
.tp-seg__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tp-seg__opt span {
  display: inline-flex; align-items: center; min-height: 30px; padding: 4px 13px; border: 1px solid var(--tp-line); border-radius: var(--tp-radius-pill);
  background: var(--tp-surface-3); color: var(--tp-text); font-size: 13px; line-height: 20px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 1px 0 var(--tp-drop);
  transition: background-color var(--tp-dur) var(--tp-ease), color var(--tp-dur) var(--tp-ease), transform 120ms var(--tp-ease), box-shadow 120ms var(--tp-ease);
}
.tp-seg__opt:hover span { background: var(--tp-surface-3-hover); color: var(--tp-text-strong); }
.tp-seg__opt:active span { transform: translateY(1px); box-shadow: none; }
.tp-seg__opt input:checked + span { border-color: var(--tp-accent-edge); background: var(--tp-accent); color: var(--tp-accent-text); }
.tp-seg__opt input:focus-visible + span { outline: 2px solid var(--tp-accent-hover); outline-offset: 2px; }

/* ---------- Tabs ---------- */
.tp-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--tp-border); overflow-x: auto; scrollbar-width: none; }
.tp-tabs::-webkit-scrollbar { display: none; }
.tp-tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px 10px; border: 0; background: none;
  color: var(--tp-text-subtle); font-family: var(--tp-font); font-weight: 700; white-space: nowrap; text-decoration: none;
  transition: color var(--tp-dur) var(--tp-ease);
}
.tp-tab:hover { color: var(--tp-text-strong); text-decoration: none; }
/* The tab row scrolls (overflow-x: auto): an outer focus ring would be cut, so it is drawn inside the tab. */
.tp-tab:focus-visible { outline-offset: -2px; }
.tp-tab::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: transparent;
  transform: scaleX(0.4); transition: transform 200ms var(--tp-ease-out), background-color var(--tp-dur) var(--tp-ease);
}
.tp-tab[aria-selected="true"], .tp-tab.is-active { color: var(--tp-accent-hover); }
.tp-tab[aria-selected="true"]::after, .tp-tab.is-active::after { background: var(--tp-accent); transform: none; }
.tp-tab__count, .tp-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--tp-surface-3); color: var(--tp-text-subtle); font-size: 11px; line-height: 20px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- Tags (soft) ---------- */
.tp-tag {
  --tp-tag-bg: var(--tp-gray-bg); --tp-tag-fg: var(--tp-gray-text);
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 20px; padding: 0 7px;
  border-radius: var(--tp-radius-xs); background: var(--tp-tag-bg); color: var(--tp-tag-fg);
  font-size: 12px; line-height: 20px; font-weight: 700; white-space: nowrap; vertical-align: middle;
}
.tp-tag .tp-icon { width: 12px; height: 12px; }
.tp-tag__text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tp-tag--link { text-decoration: none; cursor: pointer; transition: filter var(--tp-dur) var(--tp-ease); }
.tp-tag--link:hover { filter: brightness(1.18); text-decoration: none; color: var(--tp-tag-fg); }
.tp-tag--green { --tp-tag-bg: var(--tp-green-bg); --tp-tag-fg: var(--tp-green-text); }
.tp-tag--yellow { --tp-tag-bg: var(--tp-yellow-bg); --tp-tag-fg: var(--tp-yellow-text); }
.tp-tag--orange { --tp-tag-bg: var(--tp-orange-bg); --tp-tag-fg: var(--tp-orange-text); }
.tp-tag--red { --tp-tag-bg: var(--tp-red-bg); --tp-tag-fg: var(--tp-red-text); }
.tp-tag--purple { --tp-tag-bg: var(--tp-purple-bg); --tp-tag-fg: var(--tp-purple-text); }
.tp-tag--blue { --tp-tag-bg: var(--tp-blue-bg); --tp-tag-fg: var(--tp-blue-text); }
.tp-tag--sky { --tp-tag-bg: var(--tp-sky-bg); --tp-tag-fg: var(--tp-sky-text); }
.tp-tag--lime { --tp-tag-bg: var(--tp-lime-bg); --tp-tag-fg: var(--tp-lime-text); }
.tp-tag--pink { --tp-tag-bg: var(--tp-pink-bg); --tp-tag-fg: var(--tp-pink-text); }
.tp-tag--gray { --tp-tag-bg: var(--tp-gray-bg); --tp-tag-fg: var(--tp-gray-text); }

/* ---------- Card labels (strong) ---------- */
.tp-label {
  --tp-label: var(--tp-gray);
  display: inline-flex; align-items: center; min-width: 40px; max-width: 100%; height: 8px; border-radius: 4px;
  background: var(--tp-label); color: #0b0f17; vertical-align: middle;
}
.tp-label.is-expanded { min-width: 56px; height: 18px; padding: 0 8px; border-radius: var(--tp-radius-xs); font-size: 12px; line-height: 18px; font-weight: 700; }
.tp-label--lg { min-width: 48px; height: 32px; padding: 0 12px; border-radius: var(--tp-radius-sm); font-size: 14px; line-height: 32px; font-weight: 700; }
.tp-label__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-label--green { --tp-label: var(--tp-green); }
.tp-label--yellow { --tp-label: var(--tp-yellow); }
.tp-label--orange { --tp-label: var(--tp-orange); }
.tp-label--red { --tp-label: var(--tp-red); }
.tp-label--purple { --tp-label: var(--tp-purple); }
.tp-label--blue { --tp-label: var(--tp-blue); }
.tp-label--sky { --tp-label: var(--tp-sky); }
.tp-label--lime { --tp-label: var(--tp-lime); }
.tp-label--pink { --tp-label: var(--tp-pink); }
.tp-label--gray { --tp-label: var(--tp-gray); }

/* ---------- Misc ---------- */
.tp-dot { display: inline-block; width: 10px; height: 10px; flex: none; border: 1px solid var(--tp-line); border-radius: 3px; background: var(--c, var(--tp-gray)); }
.tp-spinner {
  display: inline-block; width: 18px; height: 18px; flex: none; border: 3px solid var(--tp-hover-strong);
  border-top-color: var(--tp-accent); border-radius: 50%; animation: tp-spin 0.75s linear infinite;
}
.tp-spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.tp-spinner--lg { width: 28px; height: 28px; border-width: 4px; }

/* ---------- Motion primitives ---------- */
.tp-ani { animation: tp-rise 300ms var(--tp-ease-out) both; animation-delay: calc(var(--tp-i, 0) * var(--tp-stagger, 35ms) + var(--tp-delay, 0ms)); }
.tp-hover-lift { transition: transform 200ms var(--tp-ease-out), box-shadow 200ms var(--tp-ease); }
.tp-hover-lift:hover { transform: translateY(-2px); box-shadow: var(--tp-shadow-pop-lg); }

@keyframes tp-spin { to { transform: rotate(360deg); } }
@keyframes tp-pulse { 50% { opacity: 0.5; } }
@keyframes tp-fade { from { opacity: 0; } }
@keyframes tp-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes tp-pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
@keyframes tp-spring-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes tp-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes tp-float { 50% { transform: translateY(-4px); } }
@keyframes tp-wiggle { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; scroll-behavior: auto !important; }
  .tp-spinner { animation: tp-spin 2s linear infinite !important; animation-duration: 2s !important; animation-iteration-count: infinite !important; }
}

/* The focus rule above resets the background shorthand: keep one chevron, on the right, in every look */
.tp-select, .tp-select:focus { background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
:root[data-da] .tp-select, :root[data-da] .tp-select:focus { background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
