/* 1Radar v3 — EUSpy / Monarch-style tokens
   Palette extracted from Figma file Monarch x Euspy.fig
*/
:root {
  /* Background layers */
  --bg-app:        rgb(245, 247, 250);   /* canvas behind cards */
  --bg-surface:    rgb(255, 255, 255);   /* cards, header, sidebar */
  --bg-soft:       rgb(245, 247, 250);
  --bg-darksoft:   rgb(240, 240, 240);
  --bg-night:      rgb(14, 18, 27);      /* dark CTA cards (affiliate) */

  /* Borders / dividers */
  --border:        rgb(225, 228, 234);
  --border-soft:   rgb(240, 240, 240);
  --border-dashed: rgb(202, 207, 216);
  --divider:       rgba(225, 228, 234, 0.8);

  /* Text */
  --text:          rgb(14, 18, 27);
  --text-2:        rgb(70, 70, 70);
  --text-muted:    rgb(82, 88, 102);
  --text-subtle:   rgb(143, 154, 166);
  --text-faint:    rgb(153, 160, 174);
  --text-on-dark:  rgb(255, 255, 255);

  /* Accent */
  --accent:        rgb(51, 92, 255);
  --accent-hover:  rgb(37, 71, 208);
  --accent-shadow: rgba(78, 114, 255, 0.4);
  --accent-soft:   rgb(226, 232, 255);
  --accent-glow:   rgba(197, 209, 255, 0.75);

  /* Semantic */
  --success:       rgb(16, 158, 91);
  --success-soft:  rgb(224, 250, 236);
  --warn:          rgb(245, 158, 11);
  --warn-soft:     rgb(254, 243, 199);
  --danger:        rgb(220, 53, 69);
  --danger-soft:   rgb(255, 230, 232);

  /* Shadows */
  --shadow-card:   0px 1px 2px 0px rgba(10, 13, 20, 0.03);
  --shadow-pop:    0px 8px 24px rgba(14, 18, 27, 0.10), 0 1px 2px rgba(10,13,20,0.04);
  --shadow-cta:    0 8px 18px rgba(78, 114, 255, 0.40), 0 1px 2px rgba(37, 71, 208, 0.5),
                   inset 0 0 0 1px rgba(255,255,255,0.18);

  /* Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-pill: 999px;

  /* Layout */
  --sidebar-w: 80px;
  --sidebar-w-open: 264px;
  --header-h: 88px;

  /* Type */
  --font-display: 'Inter Display', 'Inter', system-ui, sans-serif;
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
}

[data-theme='dark'] {
  --bg-app:        rgb(11, 13, 18);
  --bg-surface:    rgb(18, 21, 28);
  --bg-soft:       rgb(22, 26, 34);
  --bg-darksoft:   rgb(28, 32, 40);
  --bg-night:      rgb(10, 12, 16);
  --border:        rgba(255,255,255,0.08);
  --border-soft:   rgba(255,255,255,0.05);
  --border-dashed: rgba(255,255,255,0.14);
  --divider:       rgba(255,255,255,0.06);
  --text:          rgb(238, 240, 244);
  --text-2:        rgb(210, 214, 222);
  --text-muted:    rgb(160, 168, 180);
  --text-subtle:   rgb(120, 130, 144);
  --text-faint:    rgb(100, 110, 124);
  --shadow-card:   0 1px 2px rgba(0,0,0,.4);
  --shadow-pop:    0 12px 30px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
input, textarea, select {
  font: inherit;
  color: inherit;
}

/* Inter Display fallback (Google Fonts uses Inter; we approximate Display with feature settings) */
.font-display { font-family: var(--font-display); font-feature-settings: "ss01","cv11"; letter-spacing: -0.01em; }

/* Utilities */
.divider { height: 1px; background: var(--border); width: 100%; }
.divider-dashed { height: 0; border-top: 1px dashed var(--border-dashed); width: 100%; }

/* Inputs base */
.fld {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  letter-spacing: -0.006em;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.fld:hover { border-color: var(--text-faint); }
.fld:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.fld input { background: transparent; border: 0; outline: 0; flex: 1; min-width: 0; }
.fld input::placeholder { color: var(--text-faint); }

/* Hide native number input spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Btn base */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-sm);
  font-weight: 500; font-size: 14px; letter-spacing: -0.006em; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(0.5px); }
.btn-stroke { background: var(--bg-surface); border-color: var(--border); color: var(--text); }
.btn-stroke:hover { border-color: var(--text-faint); background: var(--bg-soft); }
.btn-lighter { background: var(--bg-soft); color: var(--text); }
.btn-lighter:hover { background: var(--border-soft); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-primary {
  background: var(--accent); color: var(--text-on-dark);
  box-shadow: var(--shadow-cta);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-night { background: var(--text); color: #fff; }
.btn-night:hover { background: #000; }
.btn-icon { width: 32px; padding: 0; }

/* Sizes */
.btn-xs { height: 24px; font-size: 12px; padding: 0 8px; gap: 4px; border-radius: 6px; }
.btn-sm { height: 28px; font-size: 13px; padding: 0 10px; }
.btn-lg { height: 40px; font-size: 14px; padding: 0 16px; border-radius: 10px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warn-soft); color: rgb(146, 64, 14); }
.badge-neutral { background: var(--bg-soft); color: var(--text-muted); }
.badge-night { background: var(--text); color: #fff; }

/* Card */
.card {
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
}
.card-md { border-radius: var(--r-md); }
.card-lg { border-radius: var(--r-2xl); }
.card-bordered { border: 1px solid var(--border); box-shadow: none; }
.card-dashed { border: 1px dashed var(--border-dashed); box-shadow: var(--shadow-card); }

/* Title / subtitle pair (top-bar style) */
.tb-title { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 28px; color: var(--text); letter-spacing: -0.005em; }
.tb-subtitle { font-family: var(--font-sans); font-weight: 500; font-size: 16px; line-height: 24px; color: var(--text-muted); letter-spacing: -0.011em; }

/* Heading scale */
.h-display { font-family: var(--font-display); font-weight: 500; font-size: 24px; line-height: 32px; letter-spacing: -0.012em; color: var(--text); }
.h-section { font-family: var(--font-display); font-weight: 500; font-size: 20px; line-height: 28px; color: var(--text); }
.h-card    { font-family: var(--font-sans); font-weight: 500; font-size: 16px; line-height: 24px; color: var(--text); letter-spacing: -0.011em; }
.t-meta    { font-size: 12px; line-height: 16px; color: var(--text-faint); }
.t-mono    { font-family: var(--font-mono); }

/* Tab icon (square gradient with icon) */
.tab-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(51,92,255,0.10), rgba(51,92,255,0.0)), var(--bg-soft);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text);
  flex-shrink: 0;
}
/* Avatar */
.avatar {
  width: 40px; height: 40px; border-radius: 999px;
  background: linear-gradient(135deg, #ff8a4c, #d34a35);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: 14px;
  flex-shrink: 0;
  position: relative;
}
.avatar.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.avatar-xs { width: 20px; height: 20px; font-size: 10px; }
.avatar.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.online::after {
  content: ""; position: absolute; bottom: -2px; right: -2px;
  width: 12px; height: 12px; border-radius: 999px;
  background: var(--success); border: 2px solid var(--bg-surface);
}

/* Sidebar nav item */
.nav-item {
  width: 100%; height: 36px; border-radius: 10px;
  display: flex; align-items: center; gap: 10px; padding: 0 10px;
  color: var(--text-muted); transition: background .12s, color .12s;
  cursor: pointer;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--text); color: #fff; }
.nav-item .nav-label { font-size: 14px; font-weight: 500; letter-spacing: -0.006em; }

/* Collapsed sidebar */
.nav-item.collapsed { width: 36px; height: 36px; padding: 0; justify-content: center; gap: 0; border-radius: 10px; }

/* Filter strip chip */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-surface);
  font-size: 13px; font-weight: 500; color: var(--text); letter-spacing: -0.006em;
  cursor: pointer; transition: all .12s;
}
.chip:hover { border-color: var(--text-faint); }
.chip.active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.chip-ghost { border: 0; background: transparent; }

/* Scrollbar */
.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.scroll::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* Toggle (switch group) */
.seg {
  display: inline-flex; padding: 4px; gap: 4px;
  background: var(--bg-soft); border-radius: 10px;
}
.seg button {
  height: 28px; padding: 0 14px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  letter-spacing: -0.006em;
}
.seg button.on { background: var(--bg-surface); color: var(--text); box-shadow: var(--shadow-card); }

/* Checkbox */
.chk {
  width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--border-dashed);
  display: grid; place-items: center; background: var(--bg-surface);
  flex-shrink: 0; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.chk.on { background: var(--text); border-color: var(--text); color: #fff; }

/* Image placeholder (striped) */
.img-stripes {
  background:
    repeating-linear-gradient(135deg, rgba(82,88,102,0.06) 0 8px, rgba(82,88,102,0.0) 8px 16px),
    var(--bg-soft);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-faint);
  font-family: var(--font-mono); font-size: 11px;
}

/* Progress */
.progress { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--text); border-radius: 999px; transition: width .3s; }

/* Subtle scrollbar hide for filter rail */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* Page wrappers */
.page-wrap { display: flex; flex-direction: column; min-height: 100vh; }
.page-body { padding: 12px; flex: 1; }
.app-shell { display: flex; min-height: 100vh; background: var(--bg-app); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; max-height: 100vh; }

/* Header bar */
.app-header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  gap: 24px;
  flex-shrink: 0;
}

/* Filter row */
.filter-strip {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}

/* Sort row (white) */
.sort-row {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 6px 24px;
  height: 48px;
  display: flex; align-items: center; justify-content: space-between;
}

/* Mocked range */
.range {
  -webkit-appearance: none; width: 130px; height: 4px;
  background: var(--bg-soft); border-radius: 999px;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 999px;
  background: var(--text); cursor: pointer; box-shadow: 0 0 0 4px rgba(14,18,27,0.06);
}

/* Top progress bar in onboarding card */
.dot-row { display: inline-flex; gap: 6px; }
.dot-row > i { width: 6px; height: 6px; border-radius: 999px; background: var(--border); }
.dot-row > i.on { background: var(--text); }
