/* TradePulse — professional gold trading terminal */

:root {
  --bg: #070708;
  --bg-elevated: #0E0E10;
  --bg-panel: rgba(16, 14, 12, 0.78);
  --panel: rgba(18, 15, 12, 0.72);
  --line: rgba(212, 175, 55, 0.22);
  --line-strong: rgba(240, 215, 140, 0.38);
  --gold: #D4AF37;
  --gold-bright: #F0D78C;
  --gold-deep: #9A7B2F;
  --gold-dim: #6E5A2A;
  --text: #F4EFE4;
  --muted: #9A9080;
  --mint: #D4AF37;
  --mint-2: #F0D78C;
  --ok: #6FBF8A;
  --danger: #D96B5C;
  --warn: #E0B86A;
  --radius: 10px;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --display: "Cinzel", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow-gold: 0 0 40px rgba(212, 175, 55, 0.08);
}

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

[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}

body { overflow-x: hidden; }

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(212, 175, 55, 0.14), transparent 55%),
    radial-gradient(ellipse 55% 40% at 95% 15%, rgba(154, 123, 47, 0.12), transparent 50%),
    radial-gradient(ellipse 80% 35% at 50% 110%, rgba(80, 60, 20, 0.35), transparent 55%),
    linear-gradient(165deg, #0C0B0A 0%, #070708 42%, #050505 100%);
}

.atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image:
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 11px,
      rgba(240, 215, 140, 0.55) 11px,
      rgba(240, 215, 140, 0.55) 12px
    );
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 70%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(212, 175, 55, 0.03) 1px, transparent 1px),
    linear-gradient(0deg, rgba(212, 175, 55, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
  animation: gridDrift 28s linear infinite;
}

.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-bright);
  line-height: 1.1;
  text-shadow: 0 0 28px rgba(212, 175, 55, 0.25);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-lockup-hero {
  justify-content: center;
  gap: 14px;
  margin: 6px 0 12px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: block;
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.28));
  transform-origin: center;
  animation: brandPulse 2.4s ease-in-out infinite;
  will-change: transform, filter;
}

.brand-lockup-hero .brand-mark {
  width: 56px;
  height: 56px;
  animation-duration: 2.8s;
}

@keyframes brandPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.22));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 18px rgba(240, 215, 140, 0.55));
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark {
    animation: none;
  }
}

.brand-text {
  min-width: 0;
}

.brand-hero {
  font-size: clamp(1.85rem, 8.5vw, 3.1rem);
  letter-spacing: clamp(0.04em, 1.2vw, 0.1em);
  margin: 4px 0 10px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.brand-lockup-hero .brand-hero {
  margin: 0;
}

.brand-sm {
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  margin: 0;
}

.login-tagline {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}

.screen-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 22px;
}

.login-inner {
  width: min(100%, 420px);
  padding: 28px 20px 32px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(160deg, rgba(212, 175, 55, 0.08), transparent 42%),
    rgba(12, 11, 10, 0.88);
  box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(240, 215, 140, 0.12);
  animation: rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
  overflow: visible;
}

.login-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-bright), var(--gold), transparent);
  animation: shimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.login-kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--gold);
}

.login-inner h1 {
  display: none; /* бренд — главный сигнал на логине */
}

.lede {
  color: var(--muted);
  margin-bottom: 26px;
  line-height: 1.5;
  font-size: 0.95rem;
}

.lede-sm {
  color: var(--muted);
  margin: -4px 0 18px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.lede-sm a { color: var(--gold-bright); }
.lede-sm code {
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--gold);
}

.login-form,
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

label span { font-weight: 500; }

input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
select {
  appearance: none;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23D4AF37' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

.btn {
  border: none;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  letter-spacing: 0.02em;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: wait; }

.btn-primary {
  background: linear-gradient(135deg, #E8C96A 0%, #D4AF37 45%, #A8842A 100%);
  color: #1A1408;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.22);
}

.btn-primary:hover {
  box-shadow: 0 10px 28px rgba(212, 175, 55, 0.32);
}

.btn-danger {
  background: rgba(217, 107, 92, 0.1);
  color: var(--danger);
  border: 1px solid rgba(217, 107, 92, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  margin-top: 16px;
  width: 100%;
}

.btn-ghost:hover {
  color: var(--gold-bright);
  border-color: var(--line-strong);
}

.form-error { color: var(--danger); font-size: 0.85rem; }
.form-msg { color: var(--ok); font-size: 0.85rem; }
.hint { margin-top: 18px; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.hint code,
.hint strong {
  color: var(--gold-bright);
  font-size: 0.78rem;
}

.app {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  flex: 0 0 auto;
  backdrop-filter: blur(18px) saturate(1.2);
  background: linear-gradient(180deg, rgba(7, 7, 8, 0.92), rgba(7, 7, 8, 0.72));
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
  z-index: 10;
}

.desk-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 6px;
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.06), transparent 55%);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.desk-strip::-webkit-scrollbar { display: none; }

.desk-pill {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1A1408;
  background: linear-gradient(135deg, #F0D78C, #D4AF37);
  padding: 3px 8px;
  border-radius: 3px;
}

.desk-pill-dim {
  background: transparent;
  color: var(--gold-deep);
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.desk-pill-ok {
  background: rgba(111, 191, 138, 0.14);
  color: var(--ok);
  border: 1px solid rgba(111, 191, 138, 0.35);
}

.desk-pill-bad {
  background: rgba(217, 107, 92, 0.14);
  color: var(--danger);
  border: 1px solid rgba(217, 107, 92, 0.35);
}

.desk-session {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
}

.desk-clock {
  margin-left: auto;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hero-equity,
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 8px;
  padding: 0;
  border: none;
}

.hero-stats-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-equity .hero-stat,
.hero-stats > div,
.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 8px;
  min-width: 0;
  height: 72px;
  min-height: 72px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.16);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.06), rgba(0, 0, 0, 0.34));
  box-sizing: border-box;
}

.hero-stats .muted,
.hero-stat-label {
  display: block;
  width: 100%;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
  min-height: 1em;
  flex: 0 0 auto;
}

.hero-stats strong,
.hero-stat-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  width: 100%;
  min-height: 2.35em;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold-bright);
  line-height: 1.15;
  word-break: normal;
  overflow-wrap: anywhere;
  flex: 0 0 auto;
}

.hero-metric-main {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  min-height: 1.15em;
  line-height: 1.15;
}

.hero-metric-unit {
  display: block;
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 1em;
  line-height: 1;
}

.hero-stats .balance-line,
.hero-stats .lev-line {
  white-space: normal;
  font-size: 0.9rem;
  margin-top: 0;
}

.hero-stats .pnl-hero {
  font-size: 0.9rem;
  white-space: normal;
  margin-top: 0;
}

.hero-stats .pnl-hero.ok,
.hero-stats .pnl-hero.ok .hero-metric-main { color: var(--ok); }
.hero-stats .pnl-hero.bad,
.hero-stats .pnl-hero.bad .hero-metric-main { color: var(--danger); }

.panel,
.chart-wrap,
.brain-card,
.login-inner {
  position: relative;
}

.panel::before,
.chart-wrap::before,
.brain-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border-top: 1px solid var(--gold-bright);
  border-left: 1px solid var(--gold-bright);
  opacity: 0.55;
  pointer-events: none;
}

.panel::after,
.chart-wrap::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--gold-bright);
  border-bottom: 1px solid var(--gold-bright);
  opacity: 0.4;
  pointer-events: none;
}

.top-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 7px 11px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.badge-on {
  background: rgba(111, 191, 138, 0.16);
  color: #8FD4A4;
  border-color: rgba(111, 191, 138, 0.55);
  box-shadow: 0 0 14px rgba(111, 191, 138, 0.22);
}

.badge-off {
  background: rgba(217, 107, 92, 0.12);
  color: #E08B7E;
  border-color: rgba(217, 107, 92, 0.45);
  box-shadow: 0 0 12px rgba(217, 107, 92, 0.16);
}

/* Toast notifications */
.toast-stack {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 4px 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 11px 12px 11px 0;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: linear-gradient(145deg, rgba(18, 16, 14, 0.96), rgba(8, 8, 9, 0.98));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px) saturate(1.15);
  animation: toastIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: hidden;
}

.toast.is-out {
  animation: toastOut 0.28s ease forwards;
}

.toast-bar {
  align-self: stretch;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}

.toast-body {
  min-width: 0;
  padding-top: 1px;
}

.toast-kicker {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.toast-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

.toast-sub {
  margin: 3px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.toast-start .toast-bar { background: linear-gradient(180deg, #8FD4A4, #3d7a52); }
.toast-start {
  border-color: rgba(111, 191, 138, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 18px rgba(111, 191, 138, 0.12);
}
.toast-start .toast-kicker { color: #8FD4A4; }

.toast-stop .toast-bar { background: linear-gradient(180deg, #E08B7E, #8a4038); }
.toast-stop {
  border-color: rgba(217, 107, 92, 0.42);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 18px rgba(217, 107, 92, 0.12);
}
.toast-stop .toast-kicker { color: #E08B7E; }

.toast-open .toast-bar { background: linear-gradient(180deg, #F0D78C, #9A7B2F); }
.toast-open {
  border-color: rgba(212, 175, 55, 0.48);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 18px rgba(212, 175, 55, 0.14);
}
.toast-open .toast-kicker { color: var(--gold-bright); }

.toast-close-trade .toast-bar { background: linear-gradient(180deg, #7EB6E8, #3a5f8a); }
.toast-close-trade {
  border-color: rgba(126, 182, 232, 0.42);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 18px rgba(126, 182, 232, 0.12);
}
.toast-close-trade .toast-kicker { color: #9EC8F0; }

.toast-warn .toast-bar { background: linear-gradient(180deg, #E0B86A, #8a6a2e); }
.toast-warn {
  border-color: rgba(224, 184, 106, 0.42);
}
.toast-warn .toast-kicker { color: var(--warn); }

.toast-error .toast-bar { background: linear-gradient(180deg, #D96B5C, #6e2e28); }
.toast-error {
  border-color: rgba(217, 107, 92, 0.55);
}
.toast-error .toast-kicker { color: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.96); }
}

.main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 14px calc(var(--nav-h) + var(--safe-b) + 10px);
}

.main.main-lock {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main.main-lock > .tab.active {
  flex: 1 1 auto;
  min-height: 0;
}

.tab { display: none; animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
.tab.active { display: block; }

#tab-home.tab.active,
#tab-positions.tab.active {
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#tab-strategy .stack,
#tab-settings .stack,
#tab-history .history-viewport,
#tab-positions .pos-desk {
  scroll-margin-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
}

#tab-strategy form.stack,
#tab-settings form.stack {
  padding-bottom: 12px;
}

.hero-status {
  padding: 16px 0 6px;
  text-align: left;
  position: relative;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4);
}

.dot.on {
  background: var(--gold);
  animation: pulse 2.2s ease-in-out infinite;
}

.price {
  font-family: var(--mono);
  font-size: clamp(2.1rem, 9vw, 2.85rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--gold-bright);
  text-shadow: 0 0 40px rgba(212, 175, 55, 0.18);
}

.price.price-tick {
  animation: priceFlash 0.55s ease-out;
}

.pnl-hero {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pnl-hero.ok { color: var(--ok); }
.pnl-hero.bad { color: var(--danger); }

.chart-wrap {
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.04), transparent 30%),
    rgba(8, 7, 6, 0.92);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(240, 215, 140, 0.08);
  position: relative;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px 0;
}

.chart-pair {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
}

.chart-source {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chart-tf-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 8px 10px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chart-sym-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0 0 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chart-sym-row::-webkit-scrollbar {
  display: none;
}

.chart-sym-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(212, 175, 55, 0.06);
  color: var(--muted);
  font: inherit;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 7px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.chart-sym-btn.active {
  color: #1A1408;
  background: linear-gradient(135deg, #F0D78C, #D4AF37);
  border-color: rgba(240, 215, 140, 0.35);
}

.chart-tf-row::-webkit-scrollbar {
  display: none;
}

.chart-tf-btn {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: rgba(212, 175, 55, 0.06);
  color: var(--muted);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chart-tf-btn:hover {
  color: var(--gold-bright);
  border-color: rgba(212, 175, 55, 0.22);
}

.chart-tf-btn.active {
  color: #1A1408;
  background: linear-gradient(135deg, #F0D78C, #D4AF37);
  border-color: rgba(240, 215, 140, 0.35);
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.2);
}

.pos-swipe-hint { margin: 2px 0 4px; text-align: center; }
.pos-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  max-width: 140px;
}
.pos-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.22);
  border: none;
  padding: 0;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.pos-dot.active {
  background: var(--gold-bright);
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.45);
}

#tab-positions .section-title {
  display: none;
}

#tab-positions .pos-desk {
  padding: 6px 10px 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
}

#tab-positions .pos-desk-head {
  margin-bottom: 6px;
}

#tab-positions .pos-swipe-hint {
  display: none;
}

#tab-positions #position-body {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#tab-positions .pos-yield-block {
  flex: 1 1 26%;
  min-height: 0;
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
}

#tab-positions .pos-yield-top {
  flex: 0 0 auto;
}

#tab-positions .pos-yield-main .pnl-big {
  font-size: clamp(1.35rem, 6vw, 1.75rem);
}

#tab-positions .pos-pnl-cash {
  font-size: 0.88rem;
}

#tab-positions .pos-yield-roe strong {
  font-size: 0.95rem;
}

#tab-positions .live-pnl {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 6px;
  gap: 5px;
  padding: 6px 8px 6px;
  display: flex;
  flex-direction: column;
}

#tab-positions .live-pnl-head {
  display: none;
}

#tab-positions .live-pnl-meter {
  flex: 0 0 auto;
}

#tab-positions .live-pnl-chart-wrap {
  flex: 1 1 auto;
  min-height: 72px;
  height: auto;
}

#tab-positions .live-pnl-svg {
  height: 100%;
  min-height: 72px;
}

#tab-positions .live-pnl-foot {
  display: block;
  flex: 0 0 auto;
  font-size: 0.52rem;
}

#tab-positions .pos-progress {
  flex: 0 0 auto;
  margin: 0;
}

#tab-positions .pos-progress .progress-labels {
  margin-bottom: 3px;
  font-size: 0.54rem;
}

#tab-positions .pos-progress .progress-bar {
  height: 8px;
}

#tab-positions .loss-review-compact {
  flex: 0 1 auto;
  padding: 8px 10px;
  max-height: none;
}

#tab-positions .loss-review-compact .loss-review-head {
  margin-bottom: 4px;
}

#tab-positions .loss-review-compact .loss-review-head .muted {
  font-size: 0.58rem;
}

#tab-positions .loss-review-compact .loss-review-head strong {
  font-size: 0.72rem;
}

#tab-positions .loss-review-compact .loss-review-story {
  -webkit-line-clamp: 4;
  font-size: 0.72rem;
  line-height: 1.35;
}

#tab-positions .loss-review-compact .loss-review-params {
  display: block;
  margin-top: 4px;
  font-size: 0.56rem;
}

#tab-positions .pos-kv {
  flex: 1 1 34%;
  min-height: 0;
  gap: 6px;
  grid-auto-rows: 1fr;
  align-content: stretch;
}

#tab-positions .pos-kv-cell {
  min-height: 0;
  padding: 8px 8px;
  gap: 3px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#tab-positions .pos-kv-cell > .muted {
  font-size: 0.52rem;
}

#tab-positions .pos-kv-cell strong {
  font-size: 0.86rem;
  line-height: 1.1;
}

#tab-positions .pos-actions {
  padding: 8px 0 0;
  margin: 0;
}

#tab-positions .pos-actions .btn {
  padding: 12px;
  font-size: 0.84rem;
}

.pos-desk {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  border-radius: 0;
  border: 1px solid rgba(212, 175, 55, 0.16);
  border-left: none;
  border-right: none;
  border-bottom: none;
  background:
    radial-gradient(120% 80% at 50% -20%, rgba(212, 175, 55, 0.1), transparent 55%),
    rgba(0, 0, 0, 0.34);
}

.pos-desk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  margin-bottom: 6px;
}

.pos-desk-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.side-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 7px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.side-badge-ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
}

.side-badge-ico path {
  fill: currentColor;
}

.side-badge-txt {
  transform: translateY(0.5px);
}

.side-badge-long {
  color: #9FE0B0;
  background: linear-gradient(135deg, rgba(111, 191, 138, 0.28), rgba(111, 191, 138, 0.08));
  border-color: rgba(111, 191, 138, 0.55);
  box-shadow: 0 0 16px rgba(111, 191, 138, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.side-badge-short {
  color: #F0A097;
  background: linear-gradient(135deg, rgba(217, 107, 92, 0.28), rgba(217, 107, 92, 0.08));
  border-color: rgba(217, 107, 92, 0.55);
  box-shadow: 0 0 16px rgba(217, 107, 92, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.pos-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--ok);
  flex-shrink: 0;
}

.pos-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(111, 191, 138, 0.55);
  animation: livePulse 1.6s ease-out infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(111, 191, 138, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(111, 191, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 191, 138, 0); }
}

.pos-empty {
  margin: auto 0;
  text-align: center;
  font-size: 0.86rem;
}

.pos-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  touch-action: pan-y;
  position: relative;
}

.pos-card::before {
  content: "";
  position: absolute;
  inset: -10px;
  pointer-events: none;
  background: radial-gradient(circle at 80% 0%, rgba(212, 175, 55, 0.08), transparent 45%);
  opacity: 0.7;
  animation: posAura 4.5s ease-in-out infinite alternate;
}

.pos-card.is-ok::before {
  background: radial-gradient(circle at 80% 0%, rgba(111, 191, 138, 0.12), transparent 48%);
}

.pos-card.is-bad::before {
  background: radial-gradient(circle at 80% 0%, rgba(217, 107, 92, 0.14), transparent 48%);
}

@keyframes posAura {
  from { opacity: 0.35; transform: translateY(0); }
  to { opacity: 0.85; transform: translateY(2px); }
}

.pos-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
}

.pos-symbol-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--gold-bright);
  line-height: 1.2;
  min-width: 0;
}

.pos-symbol-line .pos-sym {
  word-break: break-word;
  min-width: 0;
}

.pos-symbol-line .pos-idx {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(212, 175, 55, 0.06);
}

.pos-mark-live {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color 0.25s ease;
}

.pos-mark-live.tick-up {
  color: var(--ok);
  animation: markFlash 0.55s ease-out;
}

.pos-mark-live.tick-down {
  color: var(--danger);
  animation: markFlash 0.55s ease-out;
}

@keyframes markFlash {
  0% { transform: scale(1.04); filter: brightness(1.25); }
  100% { transform: scale(1); filter: brightness(1); }
}

.pos-card-hero {
  position: relative;
  z-index: 1;
  display: none;
}

.pos-yield-top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto;
  gap: 10px;
  align-items: end;
}

.pos-yield-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pos-yield-main > .muted,
.pos-yield-roe > .muted {
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pos-yield-main .pnl-big {
  font-size: clamp(1.45rem, 7vw, 1.85rem);
  margin: 0;
  line-height: 1;
}

.pos-pnl-cash {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.pos-pnl-cash.ok { color: var(--ok); }
.pos-pnl-cash.bad { color: var(--danger); }

.pos-yield-roe {
  text-align: right;
}

.pos-yield-roe strong {
  display: block;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.pos-yield-block {
  position: relative;
  z-index: 1;
  padding: 8px 8px 6px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.07), rgba(0, 0, 0, 0.38));
  overflow: hidden;
  flex: 0 0 auto;
}

.live-pnl {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px 5px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(212, 175, 55, 0.06), transparent 45%),
    rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(212, 175, 55, 0.12);
}

.live-pnl-head {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
}

.live-pnl-head strong,
#live-pnl-now {
  display: none;
}

.live-pnl-kicker {
  font-size: 0.52rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.live-pnl-head strong {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

.live-pnl-head strong.ok { color: var(--ok); }
.live-pnl-head strong.bad { color: var(--danger); }

.live-pnl-meter {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.live-pnl-track {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 7px;
  border-radius: 999px;
  overflow: visible;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.live-pnl-half {
  display: block;
  height: 100%;
}

.live-pnl-half-neg {
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, rgba(217, 107, 92, 0.55), rgba(217, 107, 92, 0.12));
}

.live-pnl-half-pos {
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, rgba(111, 191, 138, 0.12), rgba(111, 191, 138, 0.55));
}

.live-pnl-zero-line {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: rgba(240, 215, 140, 0.85);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.45);
  border-radius: 1px;
  z-index: 1;
}

.live-pnl-thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid #0a0a0b;
  box-shadow: 0 0 10px rgba(240, 215, 140, 0.5);
  z-index: 2;
  transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.live-pnl-thumb.ok {
  background: var(--ok);
  box-shadow: 0 0 12px rgba(111, 191, 138, 0.55);
}

.live-pnl-thumb.bad {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(217, 107, 92, 0.55);
}

.live-pnl-meter-labs {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.live-pnl-meter-labs span:first-child { color: #E08B7E; }
.live-pnl-meter-labs span:last-child { color: #8FD4A4; }

.live-pnl-chart-wrap {
  position: relative;
  height: 48px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(212, 175, 55, 0.08);
  overflow: hidden;
}

.live-pnl-svg {
  display: block;
  width: 100%;
  height: 48px;
}

.live-pnl-y {
  position: absolute;
  top: 4px;
  right: 3px;
  bottom: 4px;
  width: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 0.46rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.live-pnl-y-zero {
  color: rgba(240, 215, 140, 0.8);
}

.live-pnl-svg .lp-grid {
  stroke: rgba(245, 240, 232, 0.06);
  stroke-width: 0.7;
  stroke-dasharray: 2 3;
}

.live-pnl-svg .lp-zero {
  stroke: rgba(240, 215, 140, 0.55);
  stroke-width: 1.1;
}

.live-pnl-svg .lp-line {
  fill: none;
  stroke: rgba(245, 240, 232, 0.88);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.live-pnl-svg .lp-fill.ok {
  fill: rgba(111, 191, 138, 0.28);
  stroke: none;
}

.live-pnl-svg .lp-fill.bad {
  fill: rgba(217, 107, 92, 0.28);
  stroke: none;
}

.live-pnl-svg .lp-dot {
  fill: var(--gold-bright);
}

.live-pnl-svg .lp-dot.ok { fill: var(--ok); }
.live-pnl-svg .lp-dot.bad { fill: var(--danger); }

.live-pnl-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  font-size: 0.5rem;
  color: var(--muted);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  margin: 0;
  line-height: 1;
}

/* legacy spark hooks kept harmless if referenced */
.pos-spark-wrap { display: none; }

.main.main-lock:has(#tab-positions.active) {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}

.main.main-lock:has(#tab-positions.active) .section-title {
  padding-left: 0;
  padding-right: 0;
}

#tab-positions .pos-desk {
  border-radius: 0;
  border-left: none;
  border-right: none;
  margin: 0;
  flex: 1 1 auto;
}

.pos-hero-main,
.pos-hero-side > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.07), rgba(0, 0, 0, 0.38));
  box-sizing: border-box;
}

.pos-hero-side {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  min-width: 0;
}

.pos-hero-side > div {
  min-height: 0;
  padding: 6px 10px;
}

.pos-hero-main > .muted,
.pos-hero-side .muted,
.pos-kv-cell > .muted {
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--muted);
}

.pos-hero-main .pnl-big {
  font-size: clamp(1.35rem, 6.5vw, 1.7rem);
  margin: 0;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.pos-card.tick .pos-hero-main .pnl-big,
.pos-card.tick .pos-yield-main .pnl-big {
  animation: pnlTick 0.6s ease-out;
}

@keyframes pnlTick {
  0% { text-shadow: 0 0 18px currentColor; transform: translateY(-1px); }
  100% { text-shadow: none; transform: none; }
}

.pos-hero-side strong {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.pos-fund {
  position: relative;
  z-index: 1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.58rem;
}

.pos-progress {
  position: relative;
  z-index: 1;
  margin: 0;
  flex: 0 0 auto;
}

.pos-progress .progress-labels {
  margin-bottom: 4px;
  font-size: 0.58rem;
}

.pos-progress .progress-entry-lbl {
  color: var(--gold-bright);
}

.pos-progress .progress-bar {
  height: 8px;
  overflow: visible;
}

.pos-progress .progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0.7;
  animation: progressGlow 2.8s ease-in-out infinite alternate;
  background: linear-gradient(90deg, var(--danger), var(--warn));
}

.pos-progress .progress-fill.is-ok {
  background: linear-gradient(90deg, var(--danger), var(--warn), var(--ok));
}

.pos-progress .progress-fill.is-bad {
  background: linear-gradient(90deg, var(--danger), #c47b2b);
}

.progress-entry-tick {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 2px;
  height: 14px;
  margin-left: -1px;
  border-radius: 1px;
  background: rgba(240, 215, 140, 0.55);
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.35);
  pointer-events: none;
  z-index: 1;
}

.progress-marker {
  transition: left 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 2;
}

@keyframes progressGlow {
  from { filter: brightness(0.95); }
  to { filter: brightness(1.2); }
}

.pos-kv {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-height: 0;
  align-content: start;
  grid-auto-rows: auto;
}

.pos-kv-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 40px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
  overflow: hidden;
}

.pos-kv-cell strong {
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--text);
}

.pos-kv-tp strong { color: var(--ok); }
.pos-kv-sl strong { color: var(--danger); }

.pos-kv-cell .metric-sub {
  display: none;
}

.loss-review-compact {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 8px 10px;
  flex: 0 0 auto;
  flex-shrink: 0;
  max-height: none;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.08), rgba(0, 0, 0, 0.35));
  isolation: isolate;
}

.loss-review-compact.is-profit {
  border-color: rgba(111, 191, 138, 0.35);
  background: linear-gradient(145deg, rgba(111, 191, 138, 0.1), rgba(0, 0, 0, 0.35));
}

.loss-review-compact.is-loss {
  border-color: rgba(217, 107, 92, 0.35);
  background: linear-gradient(145deg, rgba(217, 107, 92, 0.1), rgba(0, 0, 0, 0.35));
}

.loss-review-compact .loss-review-head {
  margin-bottom: 4px;
}

.loss-review-compact .loss-review-story {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.3;
  margin: 0;
  color: rgba(245, 240, 232, 0.92);
}

.loss-review-compact .loss-review-params {
  display: block;
  margin: 4px 0 0;
  font-size: 0.56rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 0 0;
}

.pos-actions .btn {
  width: 100%;
  padding: 12px;
  font-size: 0.84rem;
}

#position-body { touch-action: pan-y; }

.chart-empty {
  position: absolute;
  inset: 36px 12px 36px;
  display: grid;
  place-items: center;
  margin: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  pointer-events: none;
}

.price-chart {
  width: 100%;
  height: 248px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 12px 10px;
  font-size: 0.7rem;
  color: var(--muted);
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.lg-entry::before { background: #F0D78C; }
.lg-tp::before { background: #6FBF8A; }
.lg-sl::before { background: #D96B5C; }
.lg-dca::before { background: #E0B86A; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
}

.panel-head h2 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.chip-muted {
  background: rgba(154, 144, 128, 0.12);
  color: var(--muted);
  border: 1px solid rgba(154, 144, 128, 0.18);
}

.pnl-block {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: none;
}

.pnl-block > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 68px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.05), rgba(0, 0, 0, 0.32));
}

.pnl-block > div > .muted {
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.15;
  min-height: 2.3em;
}

.pnl-block > div > strong {
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

@media (max-width: 380px) {
  .pnl-block {
    grid-template-columns: 1fr 1fr;
  }
  .pnl-block > div:first-child {
    grid-column: 1 / -1;
  }
}

.loss-review {
  margin: 0 0 14px;
  padding: 12px 13px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 55, 0.35);
  background:
    linear-gradient(145deg, rgba(217, 107, 92, 0.08), rgba(212, 175, 55, 0.06) 45%, rgba(10, 9, 8, 0.85));
  box-shadow: inset 0 1px 0 rgba(240, 215, 140, 0.1);
}

.loss-review-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.loss-review-head .muted {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.loss-review-head strong {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--warn);
  font-weight: 600;
}

.loss-review-story {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text);
}

.loss-review-params {
  margin: 8px 0 0;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.loss-review.urgent {
  border-color: rgba(217, 107, 92, 0.45);
  animation: lossPulse 2.4s ease-in-out infinite;
}

@keyframes lossPulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(240, 215, 140, 0.1), 0 0 0 0 rgba(217, 107, 92, 0); }
  50% { box-shadow: inset 0 1px 0 rgba(240, 215, 140, 0.14), 0 0 18px rgba(217, 107, 92, 0.12); }
}

.lev-line {
  margin-top: 6px;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.balance-line {
  margin-top: 6px;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--gold);
  font-family: var(--mono);
}

.brain-card {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(212, 175, 55, 0.1), rgba(10, 9, 8, 0.78) 55%);
  position: relative;
  overflow: visible;
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brain-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(240, 215, 140, 0.12), transparent 70%);
  pointer-events: none;
  animation: glowFloat 6s ease-in-out infinite;
}

.brain-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
}

.brain-top-score-only {
  min-height: 0;
}

.brain-title-wrap {
  flex: 1;
  min-width: 0;
}

.brain-title {
  margin: 0;
  font-family: var(--display);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-bright);
  line-height: 1.2;
}

.brain-meta {
  display: none;
}

.brain-score-ring {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.score-ring-svg {
  width: 64px;
  height: 64px;
  transform: rotate(0deg);
}

.score-ring-bg {
  fill: none;
  stroke: rgba(212, 175, 55, 0.15);
  stroke-width: 5;
}

.score-ring-arc {
  fill: none;
  stroke: var(--gold-bright);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 163.36;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.3s ease;
}

.score-ring-arc.ok { stroke: var(--ok); }
.score-ring-arc.mid { stroke: var(--warn); }
.score-ring-arc.bad { stroke: var(--danger); }

.brain-score-ring strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold-bright);
}

.brain-meta {
  margin-top: 6px;
  font-size: 0.74rem;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.decision-story {
  margin-top: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  position: relative;
  z-index: 1;
  letter-spacing: 0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.next-plan {
  margin-top: 14px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(0, 0, 0, 0.28);
  position: relative;
  z-index: 1;
  animation: rise 0.35s ease both;
}

.next-plan-label {
  display: block;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.next-plan strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--gold-bright);
  letter-spacing: 0.02em;
}

.next-plan .decision-story {
  margin-top: 6px;
  margin-bottom: 0;
  font-size: 0.82rem;
  color: var(--muted);
  -webkit-line-clamp: 3;
}

.scan-board {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  position: relative;
  z-index: 1;
}

.scan-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.scan-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.scan-row:hover {
  border-color: rgba(240, 215, 140, 0.35);
  background: rgba(212, 175, 55, 0.06);
}

.scan-row.active {
  border-color: rgba(240, 215, 140, 0.4);
  background: rgba(212, 175, 55, 0.08);
  transform: translateX(2px);
}

.scan-focus {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background:
    linear-gradient(160deg, rgba(212, 175, 55, 0.1), rgba(0, 0, 0, 0.35) 55%);
  animation: rise 0.35s ease both;
}

.scan-focus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.scan-focus-head strong {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--gold-bright);
  min-width: 0;
  word-break: break-word;
}

.scan-focus-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.scan-focus-ok { color: var(--ok) !important; }
.scan-focus-block { color: var(--warn) !important; }

.scan-focus-reasons {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.scan-focus-reasons li { margin-bottom: 4px; }

.scan-row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.scan-sym {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--gold-bright);
  font-size: 0.82rem;
}

.scan-side {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.scan-score {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
}

.scan-bar {
  height: 3px;
  border-radius: 99px;
  background: rgba(212, 175, 55, 0.12);
  overflow: hidden;
}

.scan-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #9A7B2F, #F0D78C);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.home-head {
  margin: 0 0 6px;
  flex: 0 0 auto;
}

.home-dots {
  display: none;
}

.pf-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
  margin: 0 0 6px;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.pf-summary .ok .pf-val { color: var(--ok); }
.pf-summary .bad .pf-val { color: var(--danger); }

.pf-summary > span,
.pf-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  height: 46px;
  min-height: 46px;
  padding: 6px 5px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
}

.pf-label {
  display: block;
  width: 100%;
  font-size: 0.54rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  line-height: 1;
  min-height: 1em;
  flex: 0 0 auto;
}

.pf-val {
  display: block;
  width: 100%;
  min-height: 1.15em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--text);
}

#pf-count {
  color: var(--gold-bright);
  font-weight: 600;
}

.open-pos-board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0 0 6px;
  overflow: hidden;
}

.open-pos-board > .analytics-label {
  flex: 0 0 auto;
  margin-bottom: 4px;
}

.open-pos-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  -webkit-overflow-scrolling: touch;
}

.open-pos-row {
  display: grid;
  grid-template-columns: minmax(52px, 1.1fr) 48px 44px minmax(64px, 1fr) 58px;
  gap: 4px 8px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border-radius: 9px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

.open-pos-row.active {
  border-color: rgba(240, 215, 140, 0.4);
  background: rgba(212, 175, 55, 0.1);
}

.open-pos-sym {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--gold-bright);
  letter-spacing: 0.02em;
}

.open-pos-side,
.open-pos-m {
  font-size: 0.64rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.open-pos-m {
  text-align: right;
}

.open-pos-pnl {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.open-pos-pct {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.open-pos-pnl.ok,
.open-pos-pct.ok { color: var(--ok); }
.open-pos-pnl.bad,
.open-pos-pct.bad { color: var(--danger); }

.analytics-panel {
  margin: 0 0 6px;
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  min-height: 0;
  box-shadow: none;
}

.analytics-panel::before {
  display: none;
}

.analytics-grid.analytics-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.analytics-dual .analytics-card {
  padding: 8px 8px 6px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.16);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(212, 175, 55, 0.1), transparent 50%),
    rgba(0, 0, 0, 0.36);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analytics-dual .analytics-label {
  text-align: center;
  margin: 0;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
}

.analytics-dual .pie-wrap {
  width: 88px;
  height: 88px;
  margin: 0 auto;
  flex: 0 0 auto;
}

.analytics-dual .pie-svg {
  width: 88px;
  height: 88px;
}

.analytics-dual .pie-center {
  inset: 18%;
  padding: 0 2px;
  overflow: hidden;
}

.analytics-dual .pie-center strong {
  font-size: 0.72rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.analytics-dual .pie-center strong.ok { color: var(--ok); }
.analytics-dual .pie-center strong.bad { color: var(--danger); }

.analytics-dual .pie-center .muted.tiny {
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  margin-top: 2px;
  line-height: 1;
}

.analytics-dual .pie-legend {
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  justify-content: flex-start;
  scrollbar-width: none;
}

.analytics-dual .pie-legend::-webkit-scrollbar {
  display: none;
}

.analytics-panel.analytics-many-pos .analytics-dual .pie-wrap,
.analytics-panel.analytics-many-pos .analytics-dual .pie-svg {
  width: 72px;
  height: 72px;
}

.analytics-panel.analytics-many-pos .analytics-dual .analytics-card {
  gap: 4px;
  padding: 6px 6px 4px;
}

.analytics-panel.analytics-many-pos .analytics-dual .pie-leg-row,
.analytics-dual .pie-legend.pie-legend-compact .pie-leg-row {
  height: 15px;
  min-height: 15px;
  font-size: 0.6rem;
  gap: 4px;
}

.analytics-panel.analytics-many-pos .analytics-dual .pie-leg-row i,
.analytics-dual .pie-legend.pie-legend-compact .pie-leg-row i {
  width: 5px;
  height: 5px;
}

.analytics-dual .pie-leg-row {
  height: 18px;
  min-height: 18px;
  font-size: 0.68rem;
  gap: 5px;
}

.analytics-dual .pie-leg-row i {
  width: 6px;
  height: 6px;
}

.analytics-pie-head,
.analytics-lists,
.analytics-list-col {
  display: none;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-height: 0;
}

.analytics-card {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: rgba(0, 0, 0, 0.28);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.analytics-label {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
  min-height: 1em;
  line-height: 1;
}

.pie-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto;
  flex: 0 0 auto;
}

.pie-svg {
  width: 88px;
  height: 88px;
}

.home-pane-portfolio {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 4px;
}

.welcome-board {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 8px;
}

.welcome-hero {
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(212, 175, 55, 0.16), transparent 55%),
    linear-gradient(165deg, rgba(28, 24, 18, 0.95), rgba(8, 8, 9, 0.92));
}

.welcome-kicker {
  margin: 0 0 6px;
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.welcome-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
}

.welcome-lede {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.welcome-feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.welcome-feats li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(0, 0, 0, 0.28);
}

.welcome-feats strong {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.welcome-feats span {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.welcome-section {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(0, 0, 0, 0.28);
}

.welcome-market {
  margin: 0 0 6px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text);
}

.welcome-plans {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.welcome-plan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.08);
  font-size: 0.78rem;
}

.welcome-plan-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.welcome-plan-sym {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--gold-bright);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-plan-side {
  color: var(--muted);
  text-transform: lowercase;
}

.welcome-plan-score {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.welcome-preview-note {
  margin: 0;
  text-align: center;
}

.portfolio-live {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 4px;
}

.home-pane-portfolio.is-welcome .portfolio-live {
  display: none;
}

.home-pane-portfolio.is-welcome .welcome-board {
  display: flex;
}

.home-pane-portfolio:not(.is-welcome) .welcome-board {
  display: none;
}

.hero-portfolio {
  padding-top: 4px;
}

.bal-block {
  position: relative;
  margin: 0 0 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.18);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(212, 175, 55, 0.14), transparent 48%),
    linear-gradient(165deg, rgba(28, 24, 18, 0.95), rgba(8, 8, 9, 0.92));
  overflow: hidden;
}

.bal-block-inner {
  display: none;
}

.bal-block-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.bal-used-pct {
  text-align: right;
  flex-shrink: 0;
}

.bal-used-pct strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gold-bright);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.bal-used-pct .muted {
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bal-meter {
  position: relative;
  z-index: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(240, 215, 140, 0.16);
  border: 1px solid rgba(212, 175, 55, 0.12);
  overflow: hidden;
  margin-bottom: 6px;
}

.bal-meter-used {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3d7a52, #6FBF8A);
  box-shadow: 0 0 10px rgba(111, 191, 138, 0.25);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.bal-split {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bal-pie {
  display: none;
}

.bal-kicker {
  display: block;
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.bal-total {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.15rem, 5.2vw, 1.4rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--gold-bright);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.bal-day-pnl {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.bal-day-pnl.ok { color: var(--ok); }
.bal-day-pnl.bad { color: var(--danger); }

.bal-total .hero-metric-main {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  min-height: 0;
  line-height: inherit;
}

.bal-total .hero-metric-unit {
  display: inline;
  margin-left: 6px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 0;
}

.bal-mode {
  display: none;
}

.trade-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 6px;
}

.trade-mode-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  background: rgba(0, 0, 0, 0.28);
  min-width: 0;
}

.trade-mode-cell > .muted {
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
}

.trade-mode-cell > strong {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bal-split {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bal-split-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 0.72rem;
  color: var(--muted);
}

.bal-split-row strong {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.bal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.bal-dot.free {
  background: #F0D78C;
  color: rgba(240, 215, 140, 0.55);
}

.bal-dot.used {
  background: #6FBF8A;
  color: rgba(111, 191, 138, 0.5);
}

.bal-pie {
  width: 84px;
  height: 84px;
  margin: 0;
}

.bal-pie .pie-svg {
  width: 84px;
  height: 84px;
}

.bal-pie .pie-center strong {
  font-size: 0.72rem;
}

@keyframes pieSpinIn {
  from { opacity: 0; transform: scale(0.86) rotate(-12deg); }
  to { opacity: 1; transform: none; }
}

.pf-summary .pf-cell {
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pf-summary .pf-cell:nth-child(1) {
  border-color: rgba(212, 175, 55, 0.28);
  background: rgba(212, 175, 55, 0.06);
}
.pf-summary .pf-cell:nth-child(2) { animation-delay: 0.1s; }
.pf-summary .pf-cell:nth-child(3) { animation-delay: 0.15s; }

.analytics-dual .analytics-card {
  animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.analytics-dual .analytics-card:nth-child(1) { animation-delay: 0.08s; }
.analytics-dual .analytics-card:nth-child(2) { animation-delay: 0.14s; }

.analytics-dual .pie-wrap {
  animation: pieSpinIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-equity,
.hero-stats {
  display: none;
}

.hero-stats-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-equity .hero-stat,
.hero-stats > div,
.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 8px;
  min-width: 0;
  height: 72px;
  min-height: 72px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.16);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.06), rgba(0, 0, 0, 0.34));
  box-sizing: border-box;
}

.home-actions {
  flex: 0 0 auto;
  margin: 0;
}

.home-actions .btn {
  padding: 9px 12px;
  font-size: 0.8rem;
}

.pie-seg {
  transition: stroke-dasharray 0.6s ease;
}

.pie-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pie-center strong {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--gold-bright);
}

.pie-legend,
.pnl-bars {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  justify-content: flex-start;
}

.pie-leg-row,
.pnl-bar-row {
  display: grid;
  align-items: center;
  height: 20px;
  min-height: 20px;
  box-sizing: border-box;
  font-size: 0.62rem;
  line-height: 1;
}

.pie-leg-row {
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 6px;
}

.pnl-bar-row {
  grid-template-columns: 44px minmax(0, 1fr) 52px;
  gap: 5px;
}

.pie-leg-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pie-leg-row span {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-leg-row strong {
  margin-left: 0;
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.pie-leg-row strong.ok { color: var(--ok); }
.pie-leg-row strong.bad { color: var(--danger); }

.pnl-bar-sym {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}

.pnl-bar-track {
  height: 5px;
  border-radius: 99px;
  background: rgba(212, 175, 55, 0.1);
  overflow: hidden;
}

.pnl-bar-track i {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.pnl-bar-track i.ok { background: linear-gradient(90deg, #3d7a52, #6FBF8A); }
.pnl-bar-track i.bad { background: linear-gradient(90deg, #8a4038, #D96B5C); }

.pnl-bar-row strong {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}

.pnl-bar-row strong.ok { color: var(--ok); }
.pnl-bar-row strong.bad { color: var(--danger); }

.slot-meter {
  height: 8px;
  border-radius: 99px;
  background: rgba(212, 175, 55, 0.12);
  overflow: hidden;
  margin-bottom: 8px;
}

.slot-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #9A7B2F, #F0D78C);
  box-shadow: 0 0 12px rgba(240, 215, 140, 0.25);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.slot-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.risk-line {
  margin-top: 12px;
  font-size: 0.78rem;
  font-family: var(--mono);
}

.nested-fieldset {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
}

.pnl-big {
  display: block;
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

.pnl-usdt strong {
  display: block;
  font-size: 1.1rem;
  margin-top: 2px;
  font-family: var(--mono);
  font-weight: 500;
}

.metrics-3 {
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 14px;
}

.metrics-pos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 14px;
  align-items: stretch;
}

.metrics-pos .metric {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 68px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.05), rgba(0, 0, 0, 0.32));
}

.metrics-pos .metric > .muted {
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.1;
  min-height: 1.1em;
}

.metrics-pos .metric > strong {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  min-height: 1.15em;
}

.metrics-pos .metric-sub {
  min-height: 2.5em;
  margin-top: 0;
}

.progress-wrap { margin-top: 4px; }

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.12);
}

.progress-fill {
  height: 100%;
  width: 50%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), var(--warn), var(--ok));
  opacity: 0.4;
}

.progress-marker {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 3px;
  height: 16px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--gold-bright);
  box-shadow: 0 0 10px rgba(240, 215, 140, 0.55);
  transition: left 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.muted { color: var(--muted); }

.chip {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(212, 175, 55, 0.14);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.chip-live {
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-bright);
  border-color: rgba(240, 215, 140, 0.55);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
}

.chip-demo {
  background: rgba(224, 184, 106, 0.12);
  color: var(--warn);
  border-color: rgba(224, 184, 106, 0.35);
}

.chip-local {
  background: rgba(154, 144, 128, 0.14);
  color: var(--muted);
  border-color: rgba(154, 144, 128, 0.28);
}

.settings-maint {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-maint legend {
  padding: 0 8px;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-maint .btn-danger {
  width: 100%;
}

.preset-card {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(212, 175, 55, 0.10), transparent 55%),
    var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preset-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
}

.preset-card .btn-primary {
  width: 100%;
}

.preset-card.is-active {
  border-color: rgba(212, 175, 55, 0.7);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.18);
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  backdrop-filter: blur(8px);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s ease;
}

.metric:hover {
  border-color: rgba(212, 175, 55, 0.35);
}

.metric strong {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.95rem;
}

.metric-sub {
  font-size: 0.72rem;
  line-height: 1.35;
  margin-top: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.metric .pos, .ok { color: var(--ok); }
.metric .neg, .bad { color: var(--danger); }

.panel h2 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.panel .metrics { margin: 0; }

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 4px;
}

.actions .btn { width: 100%; }

.section-title {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  color: var(--gold-bright);
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
  margin: 0;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

legend {
  padding: 0 8px;
  margin-bottom: 2px;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.slider-row { gap: 8px; }

.slider-row em {
  font-style: normal;
  color: var(--gold);
  font-weight: 600;
  font-family: var(--mono);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  height: 28px;
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }

.section-subtitle {
  font-size: 0.88rem;
  margin: 22px 0 10px;
  color: var(--gold);
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-head {
  margin: 0 0 12px;
}

.history-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.history-seg-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.history-seg-2 {
  grid-template-columns: 1fr 1fr;
}

.history-seg-3 .history-seg-btn {
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  padding: 10px 4px;
}

.history-seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.history-seg-btn.active {
  color: #1A1408;
  background: linear-gradient(135deg, #F0D78C, #D4AF37);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.22);
}

.history-swipe-hint {
  margin: 8px 0 6px;
  text-align: center;
}

.history-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.history-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.22);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.history-dot.active {
  background: var(--gold-bright);
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.45);
}

.history-viewport {
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
}

.history-viewport:active {
  cursor: grabbing;
}

.history-track {
  display: flex;
  width: 200%;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.history-track.index-1 {
  transform: translateX(-50%);
}

.history-track-3 {
  width: 300%;
}

.history-track-3.index-0 {
  transform: translateX(0);
}

.history-track-3.index-1 {
  transform: translateX(-33.333%);
}

.history-track-3.index-2 {
  transform: translateX(-66.666%);
}

.history-track-2 {
  width: 200%;
}

.history-track-2.index-0 {
  transform: translateX(0);
}

.history-track-2.index-1 {
  transform: translateX(-50%);
}

.history-pane {
  flex: 0 0 50%;
  width: 50%;
  min-width: 50%;
  padding-right: 2px;
}

.history-track-3 > .history-pane {
  flex: 0 0 33.333%;
  width: 33.333%;
  min-width: 33.333%;
}

.history-track-2 > .history-pane {
  flex: 0 0 50%;
  width: 50%;
  min-width: 50%;
}

.history-pane .lede-sm {
  margin-top: 0;
  margin-bottom: 14px;
}

/* Home swipe panes: Портфель | Анализ | Курс */
.home-head {
  margin: 0 0 6px;
  flex: 0 0 auto;
}

.home-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.home-seg-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.home-seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 4px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.home-seg-btn.active {
  color: #1A1408;
  background: linear-gradient(135deg, #F0D78C, #D4AF37);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.22);
}

.home-swipe-hint {
  display: none;
}

.home-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 0;
}

.home-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.22);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.home-dot.active {
  background: var(--gold-bright);
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.45);
}

.home-viewport {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
}

.home-viewport:active {
  cursor: grabbing;
}

.home-track {
  display: flex;
  width: 200%;
  height: 100%;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.home-track-3 {
  width: 300%;
}

.home-track-3.index-0 {
  transform: translateX(0);
}

.home-track-3.index-1 {
  transform: translateX(-33.333%);
}

.home-track-3.index-2 {
  transform: translateX(-66.666%);
}

.home-pane {
  flex: 0 0 50%;
  width: 50%;
  min-width: 50%;
  height: 100%;
  padding-right: 4px;
  box-sizing: border-box;
  overflow: auto;
}

.home-track-3 > .home-pane {
  flex: 0 0 33.333%;
  width: 33.333%;
  min-width: 33.333%;
}

.home-pane-portfolio {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 6px;
}

.home-actions {
  flex: 0 0 auto;
  margin: 0;
}

.home-actions .btn {
  padding: 10px 12px;
  font-size: 0.82rem;
}

.hero-portfolio .hero-stats {
  margin-top: 0;
}

.chart-hero {
  margin: 0 0 10px;
}

.chart-hero .price {
  margin: 0;
}

.trade.closed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  grid-template-columns: 1fr;
  border-left: 2px solid rgba(212, 175, 55, 0.55);
}

.trade.closed.loss {
  border-left-color: rgba(217, 107, 92, 0.65);
}

/* History cards — same language as deals desk */
.hist-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  padding: 12px 12px 13px;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: linear-gradient(155deg, rgba(22, 18, 14, 0.96), rgba(10, 9, 9, 0.98));
  box-shadow: var(--shadow-gold);
}

.hist-card::before {
  content: "";
  position: absolute;
  inset: -8px;
  pointer-events: none;
  background: radial-gradient(circle at 82% 0%, rgba(212, 175, 55, 0.1), transparent 46%);
  opacity: 0.75;
}

.hist-card.win::before {
  background: radial-gradient(circle at 82% 0%, rgba(111, 191, 138, 0.14), transparent 48%);
}

.hist-card.loss::before {
  background: radial-gradient(circle at 82% 0%, rgba(217, 107, 92, 0.16), transparent 48%);
}

.hist-card.order-card.buy::before {
  background: radial-gradient(circle at 82% 0%, rgba(111, 191, 138, 0.12), transparent 48%);
}

.hist-card.order-card.sell::before {
  background: radial-gradient(circle at 82% 0%, rgba(217, 107, 92, 0.14), transparent 48%);
}

.hist-card > * {
  position: relative;
  z-index: 1;
}

.hist-card-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.hist-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.hist-status {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.25;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-time {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-family: var(--mono);
  white-space: nowrap;
  padding-top: 2px;
}

.hist-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.hist-mark {
  font-family: var(--mono);
  font-size: clamp(1.15rem, 5.5vw, 1.45rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.hist-yield {
  margin: 0;
}

.hist-range {
  margin: 6px 0 0;
}

.hist-kv {
  flex: 0 0 auto;
  grid-auto-rows: auto;
}

.hist-kv .pos-kv-cell {
  min-height: 44px;
}

.hist-inline-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip-buy {
  background: rgba(111, 191, 138, 0.12);
  color: var(--ok);
  border-color: rgba(111, 191, 138, 0.35);
}

.chip-sell {
  background: rgba(217, 107, 92, 0.12);
  color: var(--danger);
  border-color: rgba(217, 107, 92, 0.35);
}

.hist-card .ct-why {
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  padding-top: 8px;
}

.hist-card .ct-toggle {
  align-self: stretch;
  text-align: center;
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.22);
}

.ct-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.ct-title strong {
  display: block;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.ct-meta {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 2px;
  font-family: var(--mono);
}

.ct-pnl {
  text-align: right;
  flex-shrink: 0;
}

.ct-pnl strong {
  display: block;
  font-size: 1.1rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.ct-pnl span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

.ct-pnl.ok strong { color: var(--ok); }
.ct-pnl.bad strong { color: var(--danger); }

.trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 0.82rem;
}

.ct-grid {
  grid-template-columns: 1fr 1fr;
}

@media (min-width: 720px) {
  .ct-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
}

.trade-grid span { color: var(--muted); display: block; font-size: 0.7rem; }
.trade-grid strong {
  font-weight: 500;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.ct-why {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  padding-top: 8px;
}

.ct-why span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ct-why p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text);
}

.ct-toggle {
  align-self: flex-start;
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--gold-bright);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.ct-toggle:hover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.ct-detail {
  border-top: 1px dashed rgba(212, 175, 55, 0.2);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ct-detail h4 {
  margin: 6px 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  font-family: var(--display);
}

.ct-bullets {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.ct-bullets li { margin-bottom: 4px; }

.ct-brain-meta,
.tiny {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

.trade-why {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  padding-top: 8px;
}

.news-chip {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 175, 55, 0.2);
  position: relative;
  z-index: 1;
}

.news-chip.bear {
  background: rgba(217, 107, 92, 0.12);
  color: var(--danger);
  border-color: rgba(217, 107, 92, 0.25);
}

.trades-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trade {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
}

.trade-side {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.trade-side.buy {
  background: rgba(111, 191, 138, 0.12);
  color: var(--ok);
  border: 1px solid rgba(111, 191, 138, 0.3);
}

.trade-side.sell {
  background: rgba(217, 107, 92, 0.12);
  color: var(--danger);
  border: 1px solid rgba(217, 107, 92, 0.3);
}

.trade-main strong { display: block; margin-bottom: 2px; font-family: var(--mono); font-weight: 500; }
.trade-main span { color: var(--muted); font-size: 0.82rem; }
.trade-time { color: var(--muted); font-size: 0.72rem; white-space: nowrap; font-family: var(--mono); }
.trade-reason {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* ── Order cards (History → Ордера) ── */
.order-card:not(.hist-card) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(145deg, rgba(22, 18, 14, 0.92), rgba(12, 11, 10, 0.96));
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: var(--radius);
  padding: 14px 14px 13px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-gold);
}

.order-card:not(.hist-card)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  opacity: 0.85;
}

.order-card.buy:not(.hist-card)::before {
  background: linear-gradient(180deg, rgba(111, 191, 138, 0.95), rgba(111, 191, 138, 0.35));
}

.order-card.sell:not(.hist-card)::before {
  background: linear-gradient(180deg, rgba(217, 107, 92, 0.95), rgba(217, 107, 92, 0.35));
}

.oc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-left: 6px;
}

.oc-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.oc-title strong {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  word-break: break-word;
}

.oc-side-pill {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1;
}

.order-card.buy .oc-side-pill {
  color: var(--ok);
  background: rgba(111, 191, 138, 0.12);
  border: 1px solid rgba(111, 191, 138, 0.35);
}

.order-card.sell .oc-side-pill {
  color: var(--danger);
  background: rgba(217, 107, 92, 0.12);
  border: 1px solid rgba(217, 107, 92, 0.35);
}

.oc-time {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-family: var(--mono);
  white-space: nowrap;
  padding-top: 2px;
}

.oc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 10px 10px 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(212, 175, 55, 0.1);
  border-radius: 8px;
}

.oc-stats span {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.oc-stats strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.oc-signals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 6px;
}

.oc-conf-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.oc-conf-head span {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.oc-conf-head strong {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--gold-bright);
  font-weight: 500;
}

.oc-conf-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  overflow: hidden;
}

.oc-conf-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
  transition: width 0.4s ease;
}

.oc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.oc-chip {
  font-size: 0.68rem;
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(212, 175, 55, 0.08);
  color: var(--gold-bright);
}

.oc-chip.trend-up {
  color: var(--ok);
  border-color: rgba(111, 191, 138, 0.3);
  background: rgba(111, 191, 138, 0.1);
}

.oc-chip.trend-down {
  color: var(--danger);
  border-color: rgba(217, 107, 92, 0.3);
  background: rgba(217, 107, 92, 0.1);
}

.oc-chip.trend-flat {
  color: var(--warn);
  border-color: rgba(224, 184, 106, 0.3);
  background: rgba(224, 184, 106, 0.1);
}

.oc-chip.news-bull {
  color: var(--ok);
  border-color: rgba(111, 191, 138, 0.25);
  background: rgba(111, 191, 138, 0.08);
}

.oc-chip.news-bear {
  color: var(--danger);
  border-color: rgba(217, 107, 92, 0.25);
  background: rgba(217, 107, 92, 0.08);
}

.oc-reason {
  margin: 0;
  padding: 10px 12px 10px 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(244, 239, 228, 0.82);
  border-left: 2px solid rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.04);
  border-radius: 0 6px 6px 0;
  font-style: normal;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 6px 4px var(--safe-b);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(8, 7, 6, 0.94);
  backdrop-filter: blur(18px) saturate(1.15);
  border-top: 1px solid rgba(212, 175, 55, 0.18);
  z-index: 20;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}

.bottom-nav-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.nav-item {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.58rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 8px 2px 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s ease, background 0.2s ease;
  border-radius: 8px;
  position: relative;
  min-width: 0;
}

.bottom-nav-5 .nav-item span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item.active {
  color: var(--gold-bright);
  background: rgba(212, 175, 55, 0.08);
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.45);
}

.empty-state {
  border: 1px dashed rgba(212, 175, 55, 0.28);
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  background:
    linear-gradient(145deg, rgba(212, 175, 55, 0.06), rgba(10, 9, 8, 0.5));
  position: relative;
}

.empty-state::before {
  content: "◆";
  display: block;
  font-size: 1.1rem;
  color: var(--gold-deep);
  margin-bottom: 10px;
  opacity: 0.75;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  line-height: 1;
  color: inherit;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  overflow: visible;
}

.nav-item-trade .nav-icon-trade {
  width: 26px;
  height: 26px;
}

.nav-item-trade .nav-icon-trade svg {
  width: 24px;
  height: 24px;
}

.nav-item-trade.active {
  color: var(--gold-bright);
}

.nav-item-trade.active .trade-ring {
  fill: var(--gold-bright);
  stroke: var(--gold-bright);
}

.nav-item-trade.active .trade-arrows {
  stroke: #070708;
}

.nav-item-trade.active .trade-plus-bg {
  fill: var(--gold-bright);
  stroke: #070708;
  stroke-width: 1.2;
}

.nav-item-trade.active .trade-plus {
  stroke: #070708;
}

.risk-line {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(212, 175, 55, 0.14);
  background: rgba(212, 175, 55, 0.04);
}

.tunnel-url-line {
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
  line-height: 1.45;
  color: var(--gold-bright);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  background: rgba(0, 0, 0, 0.35);
}

.settings-access {
  margin-bottom: 16px;
}

.btn-compact {
  margin-top: 0;
  padding: 10px 14px;
  font-size: 0.85rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(212, 175, 55, 0); }
}

@keyframes shimmer {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes glowFloat {
  0%, 100% { transform: translate(0, 0); opacity: 0.7; }
  50% { transform: translate(-12px, 10px); opacity: 1; }
}

@keyframes gridDrift {
  from { transform: translateY(0); }
  to { transform: translateY(48px); }
}

@keyframes priceFlash {
  0% { color: #fff6d6; text-shadow: 0 0 24px rgba(240, 215, 140, 0.55); }
  100% { color: var(--gold-bright); text-shadow: 0 0 40px rgba(212, 175, 55, 0.18); }
}

@media (min-width: 720px) {
  .main { max-width: 720px; margin: 0 auto; }
  .topbar { max-width: 720px; margin: 0 auto; }
  .desk-strip { max-width: 720px; margin: 0 auto; }
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    max-width: 720px;
    border-radius: 12px 12px 0 0;
  }
}

@media (min-width: 960px) {
  .main { max-width: 1120px; }
  .topbar { max-width: 1120px; }
  .desk-strip { max-width: 1120px; }
  .bottom-nav { max-width: 1120px; }

  .home-pane .brain-card,
  .home-pane .analytics-panel,
  .home-pane .chart-wrap {
    max-width: 720px;
  }

  .chart-wrap .price-chart,
  .chart-wrap #price-chart {
    min-height: 360px;
  }

  .login-inner {
    width: min(100%, 460px);
    padding: 36px 32px 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atmosphere::after,
  .brain-card::after,
  .login-inner::before,
  .dot.on,
  .tab,
  .login-inner,
  .loss-review.urgent {
    animation: none !important;
  }
}
