/* ============================================================
   Trading OS — премиальный дашборд
   Тёмная тема · aurora + noise + glassmorphism · GSAP/Lenis
   ============================================================ */

:root {
  --bg: #05060a;
  --bg-soft: #0a0c14;
  --panel: rgba(16, 19, 30, 0.55);
  --panel-strong: rgba(20, 24, 38, 0.78);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --text: #e8eaf2;
  --text-dim: #8b90a3;
  --text-faint: #565b6e;
  --accent: #6e8bff;
  --accent-2: #4ff2c0;
  --accent-3: #b18cff;
  --danger: #ff5d6c;
  --warn: #ffb454;
  --ok: #4ff2c0;
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

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

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

::selection { background: rgba(110, 139, 255, 0.35); }

/* ---------- Фоновые слои ---------- */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(110, 139, 255, 0.14), transparent 60%),
    radial-gradient(1000px 700px at 10% 110%, rgba(177, 140, 255, 0.10), transparent 60%),
    var(--bg);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
}

.blob-1 {
  width: 55vw; height: 55vw;
  left: -12vw; top: -14vw;
  background: radial-gradient(circle at 35% 35%, rgba(110, 139, 255, 0.55), transparent 65%);
  animation: drift1 26s ease-in-out infinite alternate;
}

.blob-2 {
  width: 48vw; height: 48vw;
  right: -10vw; top: 22vh;
  background: radial-gradient(circle at 60% 40%, rgba(79, 242, 192, 0.32), transparent 65%);
  animation: drift2 32s ease-in-out infinite alternate;
}

.blob-3 {
  width: 42vw; height: 42vw;
  left: 24vw; bottom: -18vw;
  background: radial-gradient(circle at 50% 50%, rgba(177, 140, 255, 0.4), transparent 65%);
  animation: drift3 38s ease-in-out infinite alternate;
}

@keyframes drift1 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(9vw, 7vh, 0) scale(1.18); }
}
@keyframes drift2 {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to   { transform: translate3d(-8vw, 10vh, 0) scale(0.92); }
}
@keyframes drift3 {
  from { transform: translate3d(0, 0, 0) scale(0.95); }
  to   { transform: translate3d(6vw, -8vh, 0) scale(1.12); }
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#particles {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

.cursor-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(110, 139, 255, 0.10), transparent 65%);
  transform: translate(-50%, -50%);
  transition: opacity 0.4s ease;
  opacity: 0;
  will-change: transform;
}

/* ---------- Стекло ---------- */

.glass {
  background: var(--panel);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* ---------- Навигация ---------- */

.nav {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, calc(100% - 28px));
  z-index: 50;
  border-radius: 999px;
  padding: 8px 22px;
}

.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: 0.14em; font-size: 13px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 14px var(--accent-2);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.82); } }
.brand em { font-style: normal; color: var(--accent); }

.nav-links { display: flex; gap: 22px; }
.nav-links a {
  color: var(--text-dim); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: color 0.25s ease;
}
.nav-links a:hover { color: var(--text); }

.nav-status { display: flex; align-items: center; }

.status-pill {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(79, 242, 192, 0.12);
  border: 1px solid rgba(79, 242, 192, 0.3);
  color: var(--ok);
}

.status-pill.halt { background: rgba(255, 93, 108, 0.14); border-color: rgba(255, 93, 108, 0.4); color: var(--danger); }
.status-pill.crisis { background: rgba(255, 180, 84, 0.14); border-color: rgba(255, 180, 84, 0.4); color: var(--warn); }

/* ---------- Hero ---------- */

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 140px 24px 80px;
}

.hero-inner { max-width: 900px; margin: 0 auto; text-align: center; }

.eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(34px, 6.4vw, 68px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.06;
  margin-bottom: 26px;
}

.grad-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% 100%;
  animation: grad-breathe 7s ease-in-out infinite;
}

@keyframes grad-breathe {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-sub {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 620px;
  margin: 0 auto 38px;
}

.hero-actions { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 40px; }

.hero-badges { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

.badge {
  font-size: 13px; font-weight: 500;
  padding: 9px 18px; border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  color: var(--text-dim);
  backdrop-filter: blur(12px);
}

/* ---------- Кнопки ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.4), box-shadow 0.25s ease, background 0.25s ease;
  will-change: transform;
  user-select: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-3));
  box-shadow: 0 10px 34px rgba(110, 139, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 14px 44px rgba(110, 139, 255, 0.5); }

.btn-ghost {
  color: var(--text);
  background: var(--panel);
  border-color: var(--stroke-strong);
  backdrop-filter: blur(12px);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  color: #fff;
  background: linear-gradient(120deg, #ff5d6c, #e04b5b);
  box-shadow: 0 10px 34px rgba(255, 93, 108, 0.3);
}
.btn-danger:hover { box-shadow: 0 14px 46px rgba(255, 93, 108, 0.45); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Секции ---------- */

.section { max-width: 1180px; margin: 0 auto; padding: 90px 24px; }

.section-head { margin-bottom: 40px; }

.section-title { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -0.02em; }

/* ---------- Bento ---------- */

.bento {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.bento-card {
  border-radius: var(--radius);
  padding: 26px 28px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform-style: preserve-3d;
  will-change: transform;
}

.card-label { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 14px; }

.card-big { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.card-big.sm { font-size: 22px; }
.card-big.mono { font-family: var(--mono); font-size: 27px; }

.card-note { font-size: 12.5px; color: var(--text-dim); margin-top: 10px; }

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

/* Режимные цвета */
#mRegime.scalp { color: var(--accent); }
#mRegime.trend { color: var(--accent-2); }
#mRegime.event { color: var(--warn); }
#mRegime.crisis { color: var(--danger); }
#mRegime.halt { color: var(--danger); }

#mAlert.alert-0 { color: var(--ok); }
#mAlert.alert-1 { color: var(--warn); }
#mAlert.alert-2, #mAlert.alert-3 { color: var(--danger); }

/* ---------- Панели и таблицы ---------- */

.panel { border-radius: var(--radius); padding: 30px; margin-bottom: 24px; }

.panel-title { font-size: 15px; font-weight: 700; letter-spacing: 0.04em; margin-bottom: 16px; }

.table-wrap { overflow-x: auto; margin-bottom: 24px; border-radius: var(--radius-sm); border: 1px solid var(--stroke); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

.table td { padding: 13px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); color: var(--text); white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.table .empty { text-align: center; color: var(--text-faint); padding: 22px; }

.pnl-pos { color: var(--ok); font-family: var(--mono); font-weight: 600; }
.pnl-neg { color: var(--danger); font-family: var(--mono); font-weight: 600; }

.side-buy { color: var(--ok); font-weight: 700; }
.side-sell { color: var(--danger); font-weight: 700; }

/* ---------- Риск ---------- */

.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.field { display: flex; flex-direction: column; gap: 8px; }

.field span { font-size: 13px; color: var(--text-dim); }
.field b { color: var(--text); font-weight: 600; }

.field input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110, 139, 255, 0.18); }

.risk-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.risk-hint { font-size: 12.5px; color: var(--text-faint); max-width: 520px; }

/* ---------- Калибровка ---------- */

.calib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.calib-head .control-desc { margin-top: 0; max-width: 640px; }

.select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  cursor: pointer;
  min-width: 160px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110, 139, 255, 0.18); }
.select option { background: #0a0c14; color: var(--text); }

.season-peak td { background: rgba(255, 200, 90, 0.07); }

/* ---------- Управление ---------- */

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.control-card {
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  transform-style: preserve-3d;
}

.control-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }

.control-desc { font-size: 13px; color: var(--text-dim); margin-top: 8px; }

.control-state { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-faint); }

.control-actions { display: flex; gap: 12px; }

/* Тумблер */
.toggle {
  flex: none;
  width: 54px; height: 30px;
  border-radius: 999px;
  border: 1px solid var(--stroke-strong);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  position: relative;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3), background 0.3s ease;
}

.toggle[aria-pressed="true"] { background: rgba(255, 93, 108, 0.22); border-color: rgba(255, 93, 108, 0.5); }
.toggle[aria-pressed="true"] .toggle-thumb { transform: translateX(24px); background: var(--danger); }

/* ---------- Ленты ---------- */

.feed { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 6px; }

.feed-empty { color: var(--text-faint); font-size: 14px; padding: 18px 4px; }

.feed-item {
  display: flex; gap: 14px; align-items: baseline;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13.5px;
  animation: feed-in 0.4s ease both;
}

@keyframes feed-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.feed-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); flex: none; }

.feed-tag {
  flex: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(110, 139, 255, 0.14);
  color: var(--accent);
  text-transform: uppercase;
}

.feed-tag.ai { background: rgba(177, 140, 255, 0.16); color: var(--accent-3); }
.feed-tag.risk { background: rgba(255, 180, 84, 0.14); color: var(--warn); }
.feed-tag.danger { background: rgba(255, 93, 108, 0.16); color: var(--danger); }
.feed-tag.ok { background: rgba(79, 242, 192, 0.14); color: var(--ok); }

.feed-msg { color: var(--text); }

/* ---------- Футер ---------- */

.footer {
  text-align: center;
  padding: 60px 24px 90px;
  color: var(--text-dim);
  font-size: 13px;
  border-top: 1px solid var(--stroke);
  margin-top: 40px;
}

.footer-dim { color: var(--text-faint); font-size: 12px; margin-top: 6px; }

/* ---------- Скроллбар ---------- */
/* ---------- Авторизация ---------- */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 6, 10, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.auth-screen[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-card {
  width: min(380px, 100%);
  border-radius: var(--radius);
  padding: 40px 34px;
  text-align: center;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 14px;
  margin-bottom: 6px;
}

.auth-brand .brand-name { color: var(--text); }
.auth-brand em { font-style: normal; color: var(--accent); }

.auth-sub { color: var(--text-dim); font-size: 13px; margin: 10px 0 24px; }

.auth-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  padding: 14px 16px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110, 139, 255, 0.18); }

.auth-btn { width: 100%; justify-content: center; }

.auth-error { color: var(--danger); font-size: 13px; margin-top: 14px; min-height: 18px; }

.nav-logout {
  padding: 6px 14px;
  font-size: 12px;
  margin-left: 12px;
}

/* ---------- Скроллбар ---------- */

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- Reveal (GSAP начальное состояние) ---------- */

.reveal { opacity: 0; will-change: transform, opacity; }

/* ---------- Адаптивность ---------- */

@media (max-width: 760px) {
  .nav-links { display: none; }
  .hero { padding-top: 110px; }
  .section { padding: 60px 18px; }
  .bento { grid-template-columns: 1fr 1fr; }
  .risk-footer { flex-direction: column; align-items: stretch; }
  .risk-footer .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .bento { grid-template-columns: 1fr; }
  .hero-title { font-size: 30px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .blob, .brand-dot, .grad-text { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  * { transition-duration: 0.01ms !important; }
}
