/* ============================================================
   PULSE TRADING — Base Reset & Helpers
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-1);
  background: var(--bg-base);
  line-height: var(--leading-normal);
}

/* ── Éléments de base ──────────────────────────────────────── */
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ── Données financières — toujours mono + tabular ─────────── */
.mono, .price, .pct, .pnl,
[data-price], [data-pct] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ── Helpers couleur ────────────────────────────────────────── */
.up     { color: var(--up-text); }
.down   { color: var(--down-text); }
.warn   { color: var(--warn-text); }
.muted  { color: var(--text-2); }
.dimmed { color: var(--text-3); }
.accent { color: var(--accent-text); }

/* ── Label section ─────────────────────────────────────────── */
.label {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-family: var(--font-body);
}

/* ── Field ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-2);
  font-family: var(--font-body);
}

/* ── Input ─────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-1);
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color var(--duration), box-shadow var(--duration);
}
.input::placeholder { color: var(--text-3); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ── Textarea ──────────────────────────────────────────────── */
textarea.input {
  resize: vertical;
  min-height: 100px;
  line-height: var(--leading-relaxed);
}

/* ── Toggle (checkbox custom) ──────────────────────────────── */
.toggle {
  position: relative;
  width: 38px; height: 21px;
  cursor: pointer;
  display: inline-block;
  flex-shrink: 0;
}
.toggle input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.toggle-track {
  position: absolute; inset: 0;
  border-radius: var(--r-pill);
  background: var(--bg-subtle);
  border: 0.5px solid var(--border);
  transition: all var(--duration);
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--text-3);
  transition: transform var(--duration) var(--ease), background var(--duration);
}
.toggle input:checked ~ .toggle-track {
  background: var(--up-subtle);
  border-color: var(--up-border);
}
.toggle input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(17px);
  background: var(--up);
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-sub); }

/* ── Visually hidden (accessibilité) ──────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
