/* Livv Connect — Shared theme styles */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@300;400;500;600;700;800&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-deep: #000000;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-strong: rgba(255, 255, 255, 0.04);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --text-primary: #e8f5f0;
  --text-secondary: rgba(232, 245, 240, 0.6);
  --text-tertiary: rgba(232, 245, 240, 0.4);
  
  --cyan: #00FFFC;
  --cyan-bright: #7FFFFE;
  --cyan-light: #99FFFE;
  --cyan-dark: #00B8B5;
  --cyan-glow: rgba(0, 255, 252, 0.4);
  
  --red: #ff6b6b;
  --red-bright: #F09595;
  --red-dark: #A32D2D;
  
  --amber: #ffb347;
  --amber-bright: #F0997B;
  
  --blue: #85B7EB;
  --blue-dark: #185FA5;
  
  --purple: #AFA9EC;
  --purple-dark: #534AB7;
  
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

/* Password-strength checklist (tc_password.js) — used on signup + change-password. */
.tc-pwreq {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-tertiary);
  transition: color 0.15s ease;
}
.tc-pwreq i { font-size: 14px; color: var(--text-tertiary); transition: color 0.15s ease; }
.tc-pwreq.met, .tc-pwreq.met i { color: var(--cyan-bright); }
#signup-btn:disabled, #pw-save:disabled { opacity: 0.5; cursor: not-allowed; }

html, body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* iOS Safari can auto-adjust text size (and, combined with an over-wide child, zoom the whole
     page out) which reads as "the dashboard renders smaller on a phone". Pin it to 100% so the
     layout always renders at the intended scale. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* iOS Safari: 100vh = the TALL viewport (chrome hidden), which cuts off the bottom under
     the address bar. dvh tracks the visible viewport; -webkit-fill-available is the older-iOS
     fallback; 100vh the universal fallback. Order matters — the last supported one wins. */
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  /* overflow-x: clip (NOT hidden). `hidden` forces overflow-y to compute to `auto`, turning
     the document into a scroll container — on iOS Safari that clips the bottom, and on desktop
     it produces the missing/ambiguous scrollbar. `clip` prevents horizontal scroll WITHOUT
     creating a scroll container, so overflow-y stays `visible` and the viewport scrolls
     normally (natural scrollbar on desktop, no bottom-cutoff on iOS). overscroll-behavior is
     scoped to nested scrollers (.exec-log-stream), never the document scroller. */
  overflow-x: clip;
}

/* Desktop: guarantee a visible page scrollbar when content overflows. On desktop the html
   element is the scroll root; overflow-y:auto here makes the scrollbar appear (combined with
   the base overflow-x:clip, x is clipped while y scrolls). The media query never matches on
   mobile, so the natural viewport scroll + iOS dvh fix above are untouched there. */
@media (min-width: 1024px) {
  html { overflow-y: auto; }
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
}

button:hover {
  filter: brightness(1.15);
}

button:active {
  transform: scale(0.99);
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

input {
  font-family: inherit;
  outline: none;
  border: none;
  background: transparent;
  color: inherit;
}

input::placeholder {
  color: rgba(232, 245, 240, 0.25);
}

/* Layout */
.page {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.container {
  max-width: 440px;
  margin: 0 auto;
  padding: 20px;
}

.container-wide {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
}

/* Animated background grid */
.algo-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.algo-grid svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.08;
}

/* Ambient glows */
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(20px);
  pointer-events: none;
}

.glow-green-tr {
  top: -100px;
  right: -100px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(0, 255, 252, 0.18) 0%, transparent 70%);
}

.glow-green-bl {
  bottom: -120px;
  left: -100px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(0, 255, 252, 0.1) 0%, transparent 70%);
}

.glow-purple {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(127, 119, 221, 0.08) 0%, transparent 70%);
}

/* Animations */
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px currentColor; opacity: 1; transform: scale(1); }
  50% { box-shadow: 0 0 14px currentColor; opacity: 0.6; transform: scale(1.2); }
}

@keyframes pulse-status {
  0%, 100% { box-shadow: 0 0 10px var(--cyan-bright); opacity: 1; }
  50% { box-shadow: 0 0 18px var(--cyan-bright); opacity: 0.7; }
}

@keyframes shimmer {
  0% { opacity: 0; transform: translateX(-100%); }
  15% { opacity: 1; }
  50% { opacity: 1; }
  85% { opacity: 0; }
  100% { opacity: 0; transform: translateX(100%); }
}

@keyframes aurora-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes grid-scroll {
  from { transform: translate(0, 0); }
  to { transform: translate(0, 40px); }
}

@keyframes flame-flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); filter: brightness(1); }
  50% { transform: scale(1.15) rotate(3deg); filter: brightness(1.3); }
}

@keyframes count-up-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); text-shadow: 0 0 60px rgba(127, 255, 254, 0.9), 0 2px 4px rgba(0, 0, 0, 0.3); }
  100% { transform: scale(1); }
}

.pulse-dot {
  animation: pulse-dot 1.6s ease-in-out infinite;
}

.shimmer-line {
  animation: shimmer 5s ease-in-out infinite;
}

/* Loading skeleton — shown in place of a value until real data arrives (never fake data). */
.tc-skel {
  display: inline-block; height: 1em; min-width: 70px; border-radius: 6px; vertical-align: middle;
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.13) 37%, rgba(255,255,255,0.06) 63%);
  background-size: 400% 100%; animation: tc-skel-sh 1.4s ease infinite;
}
@keyframes tc-skel-sh { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .tc-skel { animation: none; } }

.aurora {
  animation: aurora-rotate 80s linear infinite;
}

.glow-anim {
  animation: glow-pulse 6s ease-in-out infinite;
}

/* Utility cards */
.card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
}

.card-strong {
  background: var(--bg-card-strong);
  border: 0.5px solid var(--border-medium);
}

.card-green {
  background: rgba(0, 255, 252, 0.06);
  border: 0.5px solid rgba(0, 255, 252, 0.3);
}

/* Top edge accent */
.top-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.5;
}

/* Corner brackets - premium UI */
.corner-tl, .corner-tr, .corner-bl, .corner-br {
  position: absolute;
  width: 14px;
  height: 14px;
}

.corner-tl { top: 12px; left: 12px; border-top: 1px solid rgba(127, 255, 254, 0.5); border-left: 1px solid rgba(127, 255, 254, 0.5); }
.corner-tr { top: 12px; right: 12px; border-top: 1px solid rgba(127, 255, 254, 0.5); border-right: 1px solid rgba(127, 255, 254, 0.5); }
.corner-bl { bottom: 12px; left: 12px; border-bottom: 1px solid rgba(127, 255, 254, 0.5); border-left: 1px solid rgba(127, 255, 254, 0.5); }
.corner-br { bottom: 12px; right: 12px; border-bottom: 1px solid rgba(127, 255, 254, 0.5); border-right: 1px solid rgba(127, 255, 254, 0.5); }

/* Buttons */
.btn-primary {
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-dark) 100%);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 0 24px var(--cyan-glow);
  transition: filter 0.2s ease, transform 0.1s ease;
}

.btn-secondary {
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 0.5px solid var(--border-medium);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.2s ease, transform 0.1s ease;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pills/Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.badge-green {
  background: rgba(0, 255, 252, 0.2);
  color: var(--cyan-bright);
  border: 0.5px solid rgba(0, 255, 252, 0.4);
}

.badge-amber {
  background: rgba(255, 179, 71, 0.15);
  color: var(--amber);
  border: 0.5px solid rgba(255, 179, 71, 0.3);
}

.badge-blue {
  background: rgba(133, 183, 235, 0.15);
  color: var(--blue);
  border: 0.5px solid rgba(133, 183, 235, 0.3);
}

.badge-purple {
  background: rgba(127, 119, 221, 0.15);
  color: var(--purple);
  border: 0.5px solid rgba(127, 119, 221, 0.4);
}

/* Neutral "Coming Soon" pill — for not-yet-available options */
.badge-soon {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(232, 245, 240, 0.55);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
}

/* Pair pills (mono font) */
.pair-pill {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Typography */
.eyebrow {
  font-size: 10px;
  color: var(--cyan-bright);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
}

.label {
  font-size: 10px;
  color: rgba(232, 245, 240, 0.5);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
}

h1, h2, h3 {
  font-weight: 500;
  color: white;
  letter-spacing: -1px;
}

.text-mono {
  font-family: var(--font-mono);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Hover effects */
[onclick] {
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

[onclick]:hover {
  filter: brightness(1.1);
}

[onclick]:active {
  transform: scale(0.99);
}

/* Range input styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 255, 252, 0.5);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(0, 255, 252, 0.5);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Mobile responsive container */
@media (min-width: 768px) {
  .container {
    max-width: 480px;
  }
}

/* sr-only for accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── Page top bar — used by all detail pages ─────────────── */
.page-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #08090C;
  margin: 0 -20px 14px;
  padding: 14px 20px;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.04);
  z-index: 10;
}

.top-back-btn,
.top-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.top-back-btn:hover,
.top-action-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
}

.top-title {
  font-size: 15px;
  font-weight: 500;
  color: white;
  letter-spacing: -0.2px;
}

@media (min-width: 1280px) {
  .page-top-bar {
    margin: 0 0 36px;
    padding: 0;
    background: transparent;
    border-bottom: none;
    position: static;
  }
}

/* ─── Canonical desktop framing for all app pages ─────────────
   Matches history.html's established 900px → 1280px treatment.
   Any page using <body class="app-wrap"> + .app-page inherits this. */
@media (min-width: 900px) {
  body.app-wrap {
    background: #08090C;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    position: relative;
  }
  
  body.app-wrap::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      radial-gradient(circle at 20% 20%, rgba(0, 255, 252, 0.04) 0%, transparent 50%),
      radial-gradient(circle at 80% 60%, rgba(127, 119, 221, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
  }
  
  body.app-wrap > .app-page {
    max-width: 1100px;
    width: 90%;
    padding: 40px 48px 100px;
    position: relative;
    z-index: 1;
    margin: 0 auto;
  }
  
  body.app-wrap .page-top-bar {
    margin: 0 0 36px;
    padding: 0;
    background: transparent;
    position: relative;
    top: auto;
    border-bottom: none;
  }
  
  body.app-wrap .top-title {
    font-size: 22px;
    font-weight: 600;
  }
}

@media (min-width: 1280px) {
  body.app-wrap > .app-page {
    max-width: 1280px;
    width: 85%;
    padding: 48px 64px 100px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════════
   PART 475 — PREMIUM APP SURFACE (shared, every app page). Livv FX-grade depth:
   brand ambience + display-font headline metrics + glass cards + lit controls + polish.
   Brand green is written HERE so build_livv maps it to Livv cyan automatically.
   Additive overrides; no layout/markup changes. ═══════════════════════════════════════ */
:root { --font-display: 'Unbounded','Inter',-apple-system,BlinkMacSystemFont,sans-serif; }

/* 1 — brand ambience on EVERY app page (mobile + desktop), cyan-only, legibility-safe */
body.app-wrap {
  background:
    radial-gradient(1150px 620px at 80% -8%, rgba(0, 255, 252, 0.16), transparent 56%),
    radial-gradient(780px 540px at -12% 3%, rgba(0, 255, 252, 0.07), transparent 55%),
    #000000 !important;
}
/* repurpose the old desktop ::before (was faint green + off-brand purple) to a single cyan depth glow */
@media (min-width: 900px) {
  body.app-wrap::before {
    background: radial-gradient(900px 560px at 86% -4%, rgba(0, 255, 252, 0.10), transparent 55%) !important;
  }
}

/* 2 — headline-metric display face (apply to the money numbers that lead a surface) */
.tc-metric, .metric-value, .big-number { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }

/* 3 — glass depth on the standard cards (gentle, additive) */
.card, .card-strong {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.045) inset, 0 16px 38px -26px rgba(0, 0, 0, 0.78);
}
.card-green { background: linear-gradient(180deg, rgba(0, 255, 252, 0.11), rgba(0, 255, 252, 0.03)); }

/* 4 — universal polish: premium scrollbar, brand selection, focus ring */
::selection { background: rgba(0, 255, 252, 0.32); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: rgba(0, 255, 252, 0.42) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 255, 252, 0.35); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 255, 252, 0.6); background-clip: content-box; }
:focus-visible { outline: 2px solid rgba(127, 255, 254, 0.6); outline-offset: 2px; }


/* ── PART 520b — PAMM pool mode binds pool data into the EXISTING dashboard/trades/performance
   components (no injected view, no hiding of the page). Only these small helpers are new. */
.pm-tag { display:inline-flex; align-items:center; gap:6px; font-size:10px; font-weight:800; letter-spacing:.5px;
  padding:3px 9px; border-radius:20px; background:rgba(0, 255, 252, 0.16); color:var(--cyan-bright,#00FFFC); vertical-align:middle; }
.pm-tag .pm-tag-role { color:rgba(232, 245, 240, 0.7); font-weight:600; letter-spacing:.2px; }
.tc-pool-mode #risk-controls-card { display:none !important; }   /* risk controls: absent in pool mode */
/* account-only / order-management sections with no pool meaning — absent in pool mode */
.tc-pool-mode .sys-confidence, .tc-pool-mode #qa-panel, .tc-pool-mode #dash-active-list,
.tc-pool-mode #dash-copying-list, .tc-pool-mode #tc-activity-list { display:none !important; }
.tc-pool-mode #perf-acct-bar { display:none !important; }   /* perf: account switcher hidden in pool mode */
.pm-pamm-card { background:rgba(255,255,255,0.03); border:0.5px solid rgba(255,255,255,0.08); border-radius:16px; padding:18px; margin:4px 0 18px; }
.pm-pamm-card .pm-pamm-title { font-size:13px; font-weight:700; color:#fff; margin-bottom:12px; }
.pm-pamm-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
.pm-pamm-grid .pm-k { font-size:11px; color:rgba(232, 245, 240, 0.55); }
.pm-pamm-grid .pm-v { font-size:16px; font-weight:700; color:#fff; margin-top:3px; }
@media (max-width:480px){ .pm-pamm-grid { grid-template-columns:1fr 1fr; } }

/* PART 453 Livv contrast: dark ink on bright-cyan fills */
.btn-primary{color:#042020 !important;}
