/* =========================================================================
   Pulse — Design System
   "Apple glass · medical grade"
   ========================================================================= */

:root {
  --pulse-bg:           #0a0e27;
  --pulse-bg-2:         #0d1430;
  --pulse-orb-1:        #1e3a8a;
  --pulse-orb-2:        #bef264;

  --pulse-accent:       #A3E635;        /* electric mint */
  --pulse-accent-warm:  #FBBF24;        /* alt: warm gold */
  --pulse-accent-glow:  rgba(163, 230, 53, 0.30);

  --pulse-glass:        rgba(255, 255, 255, 0.05);
  --pulse-glass-2:      rgba(255, 255, 255, 0.07);
  --pulse-border:       rgba(255, 255, 255, 0.08);
  --pulse-border-hi:    rgba(255, 255, 255, 0.15);

  --pulse-text:         rgba(255, 255, 255, 0.95);
  --pulse-text-2:       rgba(255, 255, 255, 0.60);
  --pulse-text-3:       rgba(255, 255, 255, 0.40);

  --pulse-green:        #10B981;
  --pulse-amber:        #FBBF24;
  --pulse-red:          #F43F5E;
  --pulse-blue:         #60A5FA;

  --pulse-shadow:       0 20px 60px rgba(0, 0, 0, 0.45),
                        0 4px 12px rgba(163, 230, 53, 0.08);
  --pulse-shadow-lg:    0 40px 100px rgba(0, 0, 0, 0.55),
                        0 8px 24px rgba(163, 230, 53, 0.10);

  --pulse-radius:       24px;
  --pulse-radius-sm:    16px;
  --pulse-radius-xs:    10px;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--pulse-bg);
  color: var(--pulse-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4, .display {
  font-family: 'Geist', 'Inter Display', 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.tabular { font-variant-numeric: tabular-nums; }
.mono    { font-family: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace; }

/* ---------- ambient background ---------- */
.pulse-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--pulse-bg);
  overflow: hidden;
}
.pulse-bg::before,
.pulse-bg::after {
  content: '';
  position: absolute;
  width: 900px;
  height: 900px;
  border-radius: 50%;
  filter: blur(160px);
  opacity: 0.28;
  pointer-events: none;
  will-change: transform;
}
.pulse-bg::before {
  background: var(--pulse-orb-1);
  top: -300px;
  left: -200px;
  animation: drift-1 70s ease-in-out infinite;
}
.pulse-bg::after {
  background: var(--pulse-orb-2);
  bottom: -300px;
  right: -200px;
  opacity: 0.18;
  animation: drift-2 90s ease-in-out infinite;
}

@keyframes drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(160px, 80px) scale(1.08); }
  66%      { transform: translate(-80px, 220px) scale(0.95); }
}
@keyframes drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-180px, -120px) scale(1.12); }
}

/* very subtle noise on top to kill banding */
.pulse-bg::after,
.pulse-bg::before { mix-blend-mode: screen; }

/* ---------- glass card primitive ---------- */
.glass {
  position: relative;
  background: var(--pulse-glass);
  border: 1px solid var(--pulse-border);
  border-radius: var(--pulse-radius);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--pulse-shadow);
}
.glass::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--pulse-border-hi) 20%,
    var(--pulse-border-hi) 80%,
    transparent 100%);
  border-radius: var(--pulse-radius) var(--pulse-radius) 0 0;
  pointer-events: none;
}

.glass-inner {
  background: var(--pulse-glass-2);
  border: 1px solid var(--pulse-border);
  border-radius: var(--pulse-radius-sm);
  backdrop-filter: blur(36px) saturate(180%);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
}

/* stripe accent on cards */
.stripe {
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  opacity: 0.85;
}
.stripe-blue   { background: linear-gradient(90deg, transparent, var(--pulse-blue),  transparent); }
.stripe-green  { background: linear-gradient(90deg, transparent, var(--pulse-green), transparent); }
.stripe-amber  { background: linear-gradient(90deg, transparent, var(--pulse-amber), transparent); }
.stripe-red    { background: linear-gradient(90deg, transparent, var(--pulse-red),   transparent); }
.stripe-mint   { background: linear-gradient(90deg, transparent, var(--pulse-accent),transparent); }

/* ---------- KPI typography ---------- */
.kpi-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pulse-text-3);
}
.kpi-value {
  font-family: 'Geist', 'Inter Display', 'Inter', sans-serif;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--pulse-text);
  line-height: 1;
  font-size: clamp(40px, 5vw, 64px);
}
.kpi-sub {
  color: var(--pulse-text-2);
  font-size: 13px;
  font-weight: 400;
}
.kpi-value-tv {
  font-size: clamp(72px, 8vw, 128px);
}

/* ---------- chips & pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--pulse-border);
  color: var(--pulse-text-2);
}
.pill-green  { background: rgba(16,185,129,0.12);  border-color: rgba(16,185,129,0.30);  color: #6EE7B7; }
.pill-amber  { background: rgba(251,191,36,0.10);  border-color: rgba(251,191,36,0.30);  color: #FCD34D; }
.pill-red    { background: rgba(244, 63, 94, 0.10); border-color: rgba(244, 63, 94, 0.30); color: #FDA4AF; }
.pill-mint   { background: rgba(163,230,53,0.10);  border-color: rgba(163,230,53,0.30);  color: var(--pulse-accent); }

.goal-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(251,191,36,0.10);
  border: 1px solid rgba(251,191,36,0.28);
  color: #FCD34D;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.goal-chip-dot { width: 5px; height: 5px; border-radius: 50%; background: #FCD34D; }

/* live dot */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pulse-green);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: live-pulse 2.4s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all 220ms cubic-bezier(.2,.7,.2,1);
  border: 1px solid var(--pulse-border);
  background: var(--pulse-glass);
  color: var(--pulse-text);
  backdrop-filter: blur(20px);
  text-decoration: none;
}
.btn:hover { background: rgba(255,255,255,0.09); transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(180deg, var(--pulse-accent) 0%, #bef264 100%);
  color: #052b25;
  border-color: rgba(163,230,53,0.4);
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(163, 230, 53, 0.25),
              inset 0 1px 0 rgba(255,255,255,0.35);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #7ff1de 0%, #34d3be 100%);
  box-shadow: 0 12px 32px rgba(163, 230, 53, 0.35),
              inset 0 1px 0 rgba(255,255,255,0.45);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.12);
}

.btn-ai {
  background: linear-gradient(135deg, rgba(251,191,36,0.18) 0%, rgba(163,230,53,0.18) 100%);
  border: 1px solid rgba(251,191,36,0.30);
  color: #FCD34D;
  font-weight: 500;
  position: relative;
}
.btn-ai:hover {
  background: linear-gradient(135deg, rgba(251,191,36,0.28) 0%, rgba(163,230,53,0.24) 100%);
}

/* ---------- nav ---------- */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  background: rgba(10,14,39,0.65);
  border-bottom: 1px solid var(--pulse-border);
}
.nav-tab {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pulse-text-2);
  cursor: pointer;
  transition: all 180ms ease;
  text-decoration: none;
}
.nav-tab:hover { color: var(--pulse-text); background: rgba(255,255,255,0.04); }
.nav-tab.active {
  color: var(--pulse-text);
  background: rgba(255,255,255,0.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10);
}

/* ---------- wordmark ---------- */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Geist', 'Inter Display', sans-serif;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.wordmark-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pulse-accent);
  box-shadow: 0 0 16px var(--pulse-accent-glow);
  animation: live-pulse 2.4s ease-out infinite;
}

/* ---------- charts ---------- */
.bar-track {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 64px;
  padding-top: 8px;
}
.bar {
  flex: 1;
  min-width: 4px;
  background: linear-gradient(180deg, var(--pulse-accent) 0%, rgba(163,230,53,0.30) 100%);
  border-radius: 3px 3px 1px 1px;
  height: 0%;
  transition: height 700ms cubic-bezier(.2,.7,.2,1);
  position: relative;
}
.bar.bar-blue   { background: linear-gradient(180deg, var(--pulse-blue) 0%, rgba(96,165,250,0.25) 100%); }
.bar.bar-amber  { background: linear-gradient(180deg, var(--pulse-amber) 0%, rgba(251,191,36,0.25) 100%); }
.bar.bar-red    { background: linear-gradient(180deg, var(--pulse-red) 0%, rgba(244, 63, 94,0.25) 100%); }
.bar.bar-green  { background: linear-gradient(180deg, var(--pulse-green) 0%, rgba(16,185,129,0.25) 100%); }

/* sparkline */
.spark {
  width: 100%;
  height: 36px;
  display: block;
}
.spark path { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark .area { fill-opacity: 0.12; stroke: none; }

/* ---------- card fade-in stagger ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  animation: fade-in 600ms cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes fade-in {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.delay-1  { animation-delay:  60ms; }
.delay-2  { animation-delay: 120ms; }
.delay-3  { animation-delay: 180ms; }
.delay-4  { animation-delay: 240ms; }
.delay-5  { animation-delay: 300ms; }
.delay-6  { animation-delay: 360ms; }
.delay-7  { animation-delay: 420ms; }
.delay-8  { animation-delay: 480ms; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 22, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 240ms ease;
}
.modal-backdrop.show { display: flex; opacity: 1; }
.modal-panel {
  max-width: 720px;
  width: calc(100% - 32px);
  max-height: 86vh;
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  transition: transform 240ms cubic-bezier(.2,.7,.2,1);
}
.modal-backdrop.show .modal-panel {
  transform: translateY(0) scale(1);
}

/* ---------- form ---------- */
.input, select.input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--pulse-border);
  color: var(--pulse-text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 180ms ease;
}
.input:focus { border-color: var(--pulse-accent); }

/* ---------- utility ---------- */
.divider { height: 1px; background: var(--pulse-border); border: 0; }
.text-muted   { color: var(--pulse-text-3); }
.text-second  { color: var(--pulse-text-2); }

.scroll-shadow {
  background:
    linear-gradient(180deg, var(--pulse-bg) 0, transparent 8px),
    linear-gradient(0deg, var(--pulse-bg) 0, transparent 8px);
}

/* delta arrows */
.delta-up   { color: var(--pulse-green); }
.delta-down { color: var(--pulse-red); }

/* number counter wrapper */
[data-count] { font-variant-numeric: tabular-nums; }

/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .pulse-bg::before, .pulse-bg::after { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .kpi-value { font-size: clamp(36px, 9vw, 44px); }
  .glass { border-radius: 20px; }
}

/* ---------- huddle / TV mode ---------- */
.huddle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  height: 100vh;
  padding: 28px;
}
.huddle-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
}
.huddle-value {
  font-size: clamp(80px, 11vw, 168px);
  font-family: 'Geist', sans-serif;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

/* tooltip-ish hover for bars (optional) */
.bar-wrap { position: relative; flex: 1; min-width: 4px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }

/* stepper */
.stepper-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--pulse-border);
  background: rgba(255,255,255,0.04);
  color: var(--pulse-text-2);
  transition: all 280ms ease;
}
.stepper-dot.active {
  background: var(--pulse-accent);
  color: #052b25;
  border-color: var(--pulse-accent);
  box-shadow: 0 0 20px var(--pulse-accent-glow);
}
.stepper-dot.done {
  background: rgba(163,230,53,0.18);
  border-color: rgba(163,230,53,0.45);
  color: var(--pulse-accent);
}
.stepper-line {
  flex: 1;
  height: 1px;
  background: var(--pulse-border);
  margin: 0 6px;
}
.stepper-line.done { background: rgba(163,230,53,0.45); }

/* code block */
.codeblock {
  font-family: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  background: rgba(0,0,0,0.40);
  border: 1px solid var(--pulse-border);
  border-radius: 12px;
  padding: 14px 18px;
  color: #c0e9e1;
  word-break: break-all;
}
