/* Design tokens — shared design system for the platform (dark mode).
   Scales follow the ui-ux-pro-max skill: 4px spacing, fixed type/radius scales,
   primitive → semantic color tokens, accessible focus + touch targets. */
:root {
  /* Spacing (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* Type scale */
  --fs-xs: 12px; --fs-sm: 14px; --fs-base: 16px; --fs-lg: 18px;
  --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 30px;
  --lh-tight: 1.25; --lh-body: 1.55;
  --fw-normal: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700; --fw-black: 800;

  /* Radius scale */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;

  /* Primitive colors */
  --gray-950: #0b0e14; --gray-900: #141a26; --gray-850: #1a2130; --gray-800: #232c3d;
  --gray-700: #2e3950; --gray-400: #93a0b4; --gray-300: #b9c2d0; --gray-50: #f2f5fa;
  --blue-600: #3b82f6; --blue-500: #5b9cff;
  --green-600: #1f9d57; --green-500: #27c06a; --green-050: #11331f;
  --yellow-500: #e8b73a; --yellow-050: #33290e;
  --red-500: #ff6b7a; --red-600: #e5455a; --red-050: #33191d;

  /* Semantic tokens */
  --bg: var(--gray-950); --surface: var(--gray-900); --surface-2: var(--gray-850);
  --text: var(--gray-50); --text-muted: var(--gray-400); --text-dim: var(--gray-300);
  --border: var(--gray-800); --border-strong: var(--gray-700);
  --primary: var(--blue-500); --primary-fg: #051327;
  --success: var(--green-500); --success-bg: var(--green-050);
  --warning: var(--yellow-500); --warning-bg: var(--yellow-050);
  --danger: var(--red-500); --danger-bg: var(--red-050);
  --focus: var(--blue-500);

  /* Elevation */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3);
  --shadow-md: 0 4px 14px rgb(0 0 0 / .35);
  --shadow-lg: 0 14px 34px rgb(0 0 0 / .45);

  /* Motion */
  --t-fast: 150ms; --t-med: 220ms; --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--fw-normal) var(--fs-base)/var(--lh-body) -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Accessible focus for everything interactive */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
a { color: var(--primary); text-decoration: none; }

/* Icons */
.ic { width: 1em; height: 1em; vertical-align: -0.13em; flex: 0 0 auto; }
.ic-lg { width: 1.2em; height: 1.2em; vertical-align: -0.18em; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); }

/* Button (min 44px touch target) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-5); border: 1px solid transparent; border-radius: var(--r-md);
  font-size: var(--fs-base); font-weight: var(--fw-bold); cursor: pointer; text-decoration: none;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: #6fa8ff; }
.btn-block { width: 100%; }

/* Badge */
.badge { display: inline-flex; align-items: center; gap: var(--sp-1); padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-black); letter-spacing: .3px; }
.badge svg { width: 13px; height: 13px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* Utility */
.muted { color: var(--text-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
