/* ==========================================================================
   YourCryptoPal Payouts: design tokens (the same as Merchants), reset and typography.
   Light is the default; dark applies when the viewer picks it with the theme
   toggle (data-theme="dark") or when their OS prefers dark and they have not
   picked light.
   ========================================================================== */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-latin-700-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* Brand and surfaces match the admin panel (/mnt/project-files/design-reference/tokens.css). */
  --brand: #155791;
  --brand-2: #0b2f52;
  --brand-gradient: linear-gradient(135deg, #155791 0%, #0b2f52 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(21, 87, 145, 0.9) 0%, rgba(11, 47, 82, 0.92) 100%);

  /* Surfaces */
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --overlay: rgba(11, 18, 32, 0.5);

  /* Ink */
  --text: #0f1b2d;
  --text-2: #4a5668;
  --muted: #6f7b8e;
  --on-brand: #ffffff;

  /* Lines */
  --border: #e3e8ef;
  --border-strong: #cfd7e3;
  --focus-ring: 0 0 0 3px rgba(21, 87, 145, 0.25);

  /* Accent (interactive) */
  --primary: #155791;
  --primary-hover: #114a7c;
  --primary-soft: #e7f0f8;

  /* Status: a fill for icons/dots, a text step that clears 4.5:1, and a tint */
  --ok: #0ca30c;
  --ok-text: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #fab219;
  --warn-text: #b45309;
  --warn-soft: #fdf3e2;
  --serious: #ec835a;
  --serious-text: #a2431d;
  --serious-soft: rgba(236, 131, 90, 0.15);
  --danger: #d03b3b;
  --danger-text: #b91c1c;
  --danger-soft: #fdecec;
  --info: #2a78d6;
  --info-text: #1f63b5;
  --info-soft: rgba(42, 120, 214, 0.1);
  --neutral-soft: #eef2f7;

  /* Charts (single-series volume uses --chart-1) */
  --chart-surface: #ffffff;
  --chart-1: #2a78d6;
  --chart-2: #eb6834;
  --chart-3: #1baf7a;
  --chart-4: #eda100;
  --chart-5: #e87ba4;
  --chart-6: #008300;
  --chart-7: #4a3aa7;
  --chart-8: #e34948;
  --chart-grid: #e8edf3;
  --chart-axis: #c6cedb;

  /* Shape */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.05);
  --shadow: 0 4px 20px rgba(15, 27, 45, 0.06);
  --shadow-lg: 0 20px 45px rgba(15, 27, 45, 0.16);

  /* Type */
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.1875rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2.125rem;

  /* Layout */
  --sidebar-w: 256px;
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1220;
    --surface: #111a2b;
    --surface-2: #16223a;
    --surface-3: #1b2945;
    --overlay: rgba(3, 6, 12, 0.66);
    --text: #e6edf7;
    --text-2: #a8b3c7;
    --muted: #8591a8;
    --border: #22304a;
    --border-strong: #2e3f5f;
    --focus-ring: 0 0 0 3px rgba(94, 163, 224, 0.35);
    --primary: #5ea3e0;
    --primary-hover: #7ab4e8;
    --primary-soft: #15304d;
    --brand-gradient: linear-gradient(135deg, #174f82 0%, #07192e 100%);
    --ok-text: #4ade80;
    --warn-text: #fbbf24;
    --serious-text: #f19d7c;
    --danger-text: #f87171;
    --info-text: #6ea8ef;
    --ok-soft: #0f2e1d;
    --warn-soft: #33250b;
    --serious-soft: rgba(236, 131, 90, 0.16);
    --danger-soft: #3a1515;
    --info-soft: rgba(57, 135, 229, 0.18);
    --neutral-soft: #1b2945;
    --chart-surface: #111a2b;
    --chart-1: #3987e5;
    --chart-2: #d95926;
    --chart-3: #199e70;
    --chart-4: #c98500;
    --chart-5: #d55181;
    --chart-6: #008300;
    --chart-7: #9085e9;
    --chart-8: #e66767;
    --chart-grid: #1f2c44;
    --chart-axis: #2f3e5c;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 24px 50px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111a2b;
  --surface-2: #16223a;
  --surface-3: #1b2945;
  --overlay: rgba(3, 6, 12, 0.66);
  --text: #e6edf7;
  --text-2: #a8b3c7;
  --muted: #8591a8;
  --border: #22304a;
  --border-strong: #2e3f5f;
  --focus-ring: 0 0 0 3px rgba(94, 163, 224, 0.35);
  --primary: #5ea3e0;
  --primary-hover: #7ab4e8;
  --primary-soft: #15304d;
  --brand-gradient: linear-gradient(135deg, #174f82 0%, #07192e 100%);
  --ok-text: #4ade80;
  --warn-text: #fbbf24;
  --serious-text: #f19d7c;
  --danger-text: #f87171;
  --info-text: #6ea8ef;
  --ok-soft: #0f2e1d;
  --warn-soft: #33250b;
  --serious-soft: rgba(236, 131, 90, 0.16);
  --danger-soft: #3a1515;
  --info-soft: rgba(57, 135, 229, 0.18);
  --neutral-soft: #1b2945;
  --chart-surface: #111a2b;
  --chart-1: #3987e5;
  --chart-2: #d95926;
  --chart-3: #199e70;
  --chart-4: #c98500;
  --chart-5: #d55181;
  --chart-6: #008300;
  --chart-7: #9085e9;
  --chart-8: #e66767;
  --chart-grid: #1f2c44;
  --chart-axis: #2f3e5c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 24px 50px rgba(0, 0, 0, 0.5);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-base); }

p {
  margin: 0;
}

code,
kbd,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

::selection {
  background: var(--primary-soft);
}

[hidden] {
  display: none !important;
}

.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;
}

/* ---------- Text helpers ---------- */
.text-muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-ok { color: var(--ok-text); }
.text-warn { color: var(--warn-text); }
.text-danger { color: var(--danger-text); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.break-all { word-break: break-all; }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: var(--gap, 1rem); }
.row { display: flex; align-items: center; gap: var(--gap, 0.75rem); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 0.75rem); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: var(--gap, 1.25rem); }
.grid-2 { display: grid; gap: var(--gap, 1.25rem); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: var(--gap, 1.25rem); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: var(--gap, 1.25rem); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

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