/* ==========================================================================
   WhatSend Trades — Design System v2
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   TOKENS
   ========================================================================== */
:root {
  --bg:            #F5F4F0;
  --bg-elevated:   rgba(255,255,255,0.82);
  --bg-muted:      rgba(240,239,234,0.9);
  --bg-subtle:     rgba(228,226,218,0.8);
  --border:        rgba(210,207,197,0.7);
  --border-strong: rgba(180,177,165,0.9);
  --text:          #18181B;
  --text-muted:    #636363;
  --text-subtle:   #9A9A9A;
  --primary:       #18181B;
  --primary-text:  #FFFFFF;
  --accent:        #6366F1;
  --accent-bg:     rgba(99,102,241,0.08);
  --profit:        #059669;
  --profit-bg:     rgba(5,150,105,0.09);
  --loss:          #DC2626;
  --loss-bg:       rgba(220,38,38,0.08);
  --warning:       #D97706;
  --warning-bg:    rgba(217,119,6,0.09);
  --glow-1:        rgba(255,196,100,0.28);
  --glow-2:        rgba(150,195,255,0.20);
  --glow-3:        rgba(140,220,160,0.16);
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.07);
  --shadow-md:  0 8px 28px rgba(0,0,0,0.10);
  --shadow-lg:  0 20px 52px rgba(0,0,0,0.13);
  --shadow-xl:  0 32px 72px rgba(0,0,0,0.16);
  --card-bg:    rgba(255,255,255,0.72);
  --sidebar-bg: rgba(255,255,255,0.78);
  --bar-bg:     rgba(255,255,255,0.80);
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-full: 9999px;
  --ease:        cubic-bezier(0.4,0,0.2,1);
  --ease-out:    cubic-bezier(0,0,0.2,1);
  --ease-spring: cubic-bezier(0.34,1.56,0.64,1);
  --ease-bounce: cubic-bezier(0.68,-0.55,0.265,1.55);
  --duration-fast:   120ms;
  --duration-base:   200ms;
  --duration-slow:   350ms;
  --duration-xslow:  500ms;
}

[data-theme="dark"] {
  --bg:            #080808;
  --bg-elevated:   rgba(20,20,20,0.85);
  --bg-muted:      rgba(30,30,30,0.9);
  --bg-subtle:     rgba(42,42,42,0.85);
  --border:        rgba(48,48,48,0.9);
  --border-strong: rgba(70,70,70,0.95);
  --text:          #F0F0F0;
  --text-muted:    #9A9A9A;
  --text-subtle:   #5A5A5A;
  --primary:       #F0F0F0;
  --primary-text:  #0A0A0A;
  --accent:        #818CF8;
  --accent-bg:     rgba(129,140,248,0.10);
  --profit:        #10B981;
  --profit-bg:     rgba(16,185,129,0.10);
  --loss:          #EF4444;
  --loss-bg:       rgba(239,68,68,0.10);
  --warning:       #F59E0B;
  --warning-bg:    rgba(245,158,11,0.10);
  --glow-1:        rgba(120,60,200,0.14);
  --glow-2:        rgba(20,80,180,0.12);
  --glow-3:        rgba(20,120,100,0.10);
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.5);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.6);
  --shadow-md:  0 8px 28px rgba(0,0,0,0.7);
  --shadow-lg:  0 20px 52px rgba(0,0,0,0.8);
  --shadow-xl:  0 32px 72px rgba(0,0,0,0.9);
  --card-bg:    rgba(20,20,20,0.75);
  --sidebar-bg: rgba(14,14,14,0.85);
  --bar-bg:     rgba(16,16,16,0.88);
}

/* ==========================================================================
   RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Gradient mesh background — fixed, full viewport */
  background:
    radial-gradient(ellipse 90% 60% at 8% 0%,   var(--glow-1) 0%, transparent 52%),
    radial-gradient(ellipse 55% 65% at 88% 8%,  var(--glow-2) 0%, transparent 52%),
    radial-gradient(ellipse 65% 50% at 80% 95%, var(--glow-3) 0%, transparent 52%),
    radial-gradient(ellipse 40% 40% at 20% 80%, var(--glow-2) 0%, transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  transition: color var(--duration-slow) var(--ease), background-color var(--duration-slow) var(--ease);
}

/* Grain overlay */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 220px 220px;
}

[data-theme="dark"] html::before { opacity: 0.055; }

body {
  background: transparent;
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: color var(--duration-slow) var(--ease);
  position: relative;
  z-index: 1;
}

/* ── Focus ring global ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

:focus:not(:focus-visible) { outline: none; }

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-feature-settings: "tnum" 1;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
img, svg { display: block; }

/* ==========================================================================
   APP LAYOUT
   ========================================================================== */
.app {
  display: flex;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

.main {
  flex: 1;
  min-width: 0;
  /* z-index: 0 prevents the pageIn animation's transform from creating a
     stacking context that could paint over the fixed sidebar / bottombar */
  position: relative;
  z-index: 0;
  animation: pageIn var(--duration-xslow) var(--ease-out) both;
}

/* Desktop: push the main area right so it never sits under the 68 px sidebar */
@media (min-width: 768px) {
  .main {
    margin-left: 68px;
    display: flex;
    justify-content: center;
    padding: 0 32px;
  }
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile: bottom padding must clear the fixed bottombar (≈65 px tall,
   positioned 14 px from the viewport bottom) plus safe-area-inset on notch
   devices.  Desktop: only needs to clear the smaller bottom bar that's hidden. */
.content {
  width: 100%;
  /* 24px top breathing room + 18px side gutters
     bottom: 14px (bar offset) + ~65px (bar height) + 20px extra + safe-area */
  padding: 24px 18px calc(100px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  .content {
    max-width: 800px;
    padding: 52px 0 80px;
  }
}

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 36px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .page-title {
  background: linear-gradient(135deg, #FFFFFF 0%, #9A9A9A 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 5px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

@media (min-width: 768px) { .page-title { font-size: 34px; } }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  display: none;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: 68px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid var(--border);
  /* z-index must beat .main (z-index: 0) and all content stacking contexts */
  z-index: 100;
  transition: width 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s;
  overflow: hidden;
  flex-direction: column;
}

@media (min-width: 768px) {
  .sidebar { display: flex; }
  .sidebar:hover {
    width: 220px;
    box-shadow: var(--shadow-xl);
  }
}

.sidebar-logo {
  padding: 22px 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-logo-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--primary);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base);
}

.sidebar:hover .sidebar-logo-mark {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

.sidebar-logo-mark::after {
  content: "";
  width: 10px; height: 10px;
  background: var(--primary-text);
  border-radius: 3px;
}

.sidebar-logo-text {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.03em;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  white-space: nowrap;
}

.sidebar:hover .sidebar-logo-text { opacity: 1; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 10px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--duration-base) var(--ease),
              color var(--duration-base) var(--ease),
              transform var(--duration-fast) var(--ease),
              box-shadow var(--duration-base);
  overflow: hidden;
  position: relative;
}

.sidebar-link:hover {
  background: var(--bg-muted);
  color: var(--text);
  transform: translateX(2px);
}

.sidebar-link:active { transform: scale(0.96) translateX(1px); }

.sidebar-link.active {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}

.sidebar-link.active:hover { transform: translateX(0); }

.sidebar-link svg {
  width: 20px; height: 20px;
  stroke-width: 1.8;
  flex-shrink: 0;
  transition: transform var(--duration-base) var(--ease-spring);
}
.sidebar-link:hover svg { transform: scale(1.1); }
.sidebar-link.active svg { stroke-width: 2.2; transform: none; }
.sidebar-link-text {
  opacity: 0;
  transition: opacity 0.18s var(--ease);
}
.sidebar:hover .sidebar-link-text { opacity: 1; }

.sidebar-footer { padding: 0 10px 20px; flex-shrink: 0; }

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 10px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.theme-toggle:hover { background: var(--bg-muted); color: var(--text); }
.theme-toggle svg { width: 20px; height: 20px; stroke-width: 1.8; flex-shrink: 0; transition: transform 0.5s var(--ease-spring); }
.theme-toggle:hover svg { transform: rotate(30deg); }
.theme-toggle-text { opacity: 0; transition: opacity 0.2s var(--ease); }
.sidebar:hover .theme-toggle-text { opacity: 1; }

/* Mobile toggle */
.mobile-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.mobile-theme-toggle:active { transform: scale(0.9); }
.mobile-theme-toggle svg { width: 18px; height: 18px; stroke-width: 1.8; transition: transform 0.5s var(--ease-spring); }
.mobile-theme-toggle:active svg { transform: rotate(30deg); }
@media (min-width: 768px) { .mobile-theme-toggle { display: none; } }

/* ==========================================================================
   BOTTOM BAR
   ========================================================================== */
.bottombar {
  position: fixed;
  /* Respect the device safe area so the bar is never hidden behind the
     iOS home indicator. bottom = 14px design offset + safe-area-inset. */
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  right: 14px;
  background: var(--bar-bg);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 6px;
  /* z-index must beat .main (z-index: 0) and all content stacking contexts */
  z-index: 100;
  display: flex;
  justify-content: space-around;
  box-shadow: var(--shadow-xl), 0 0 0 0.5px rgba(255,255,255,0.06) inset;
}

@media (min-width: 768px) { .bottombar { display: none; } }

.bottombar-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px;
  border-radius: 21px;
  color: var(--text-subtle);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: background var(--duration-base) var(--ease),
              color var(--duration-base) var(--ease),
              transform var(--duration-fast) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.bottombar-link svg {
  width: 22px; height: 22px;
  stroke-width: 1.8;
  transition: transform 0.28s var(--ease-spring), stroke-width 0.2s;
}

.bottombar-link.active {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2), 0 0 0 0.5px rgba(255,255,255,0.1) inset;
}

.bottombar-link.active svg { transform: scale(1.12); stroke-width: 2.2; }
.bottombar-link:not(.active):active { transform: scale(0.86); }
.bottombar-link:not(.active):hover { color: var(--text-muted); }

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  transition: border-color var(--duration-base),
              box-shadow var(--duration-base),
              transform var(--duration-base) var(--ease);
  position: relative;
  overflow: hidden;
}

/* Subtle inner highlight on top edge */
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5) 50%, transparent);
  pointer-events: none;
}

[data-theme="dark"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07) 50%, transparent);
}

.card-sm { padding: 18px; }

.card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Card accent top border — para cards com destaque colorido */
.card-accent-profit {
  border-top: 2px solid var(--profit);
}

.card-accent-loss {
  border-top: 2px solid var(--loss);
}

/* ==========================================================================
   STATS GRID
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }

.stat {
  background: var(--card-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 20px 18px;
  transition: border-color var(--duration-base),
              box-shadow var(--duration-base),
              transform var(--duration-base) var(--ease);
  animation: statIn 0.55s var(--ease-out) both;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5) 50%, transparent);
  pointer-events: none;
}

[data-theme="dark"] .stat::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07) 50%, transparent);
}

.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }

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

.stat:nth-child(1) { animation-delay: 0.05s; }
.stat:nth-child(2) { animation-delay: 0.10s; }
.stat:nth-child(3) { animation-delay: 0.15s; }
.stat:nth-child(4) { animation-delay: 0.20s; }

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color var(--duration-base);
}

@media (min-width: 640px) { .stat-value { font-size: 28px; } }

.stat-value.profit { color: var(--profit); }
.stat-value.loss   { color: var(--loss); }

.stat-meta {
  font-size: 11.5px;
  color: var(--text-subtle);
  margin-top: 8px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Micro-trend indicator no stat */
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-full);
  margin-top: 6px;
}
.stat-trend.up   { background: var(--profit-bg); color: var(--profit); }
.stat-trend.down { background: var(--loss-bg);   color: var(--loss); }

/* ==========================================================================
   SECTION HEADING
   ========================================================================== */
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 32px 0 14px;
}

.section-heading h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.section-heading-link {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  transition: color var(--duration-fast), gap var(--duration-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.section-heading-link:hover {
  color: var(--text);
  gap: 6px;
}

/* ==========================================================================
   CHART
   ========================================================================== */
.chart-canvas {
  width: 100% !important;
  height: 180px !important;
  display: block;
}

/* ==========================================================================
   TRADES LIST
   ========================================================================== */
.trade-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trade-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color var(--duration-base),
              box-shadow var(--duration-base),
              transform var(--duration-base) var(--ease),
              background var(--duration-base);
  animation: itemIn 0.38s var(--ease-out) both;
  position: relative;
  overflow: hidden;
}

.trade-item::after {
  content: "";
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45) 50%, transparent);
  pointer-events: none;
}

[data-theme="dark"] .trade-item::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06) 50%, transparent);
}

.trade-item::before {
  content: "";
  position: absolute;
  left: 0; top: 15%; bottom: 15%;
  width: 3px;
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 0 3px 3px 0;
}

.trade-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}
.trade-item:active { transform: scale(0.99); }
.trade-item:hover::before { opacity: 1; }
.trade-item.profit-item::before { background: var(--profit); }
.trade-item.loss-item::before   { background: var(--loss); }

.trade-item.profit-item:hover { background: rgba(5,150,105,0.015); }
.trade-item.loss-item:hover   { background: rgba(220,38,38,0.015); }
[data-theme="dark"] .trade-item.profit-item:hover { background: rgba(16,185,129,0.04); }
[data-theme="dark"] .trade-item.loss-item:hover   { background: rgba(239,68,68,0.04); }

@keyframes itemIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.trade-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform var(--duration-base) var(--ease-spring);
}
.trade-item:hover .trade-icon { transform: scale(1.08); }

.trade-icon.profit { background: var(--profit-bg); color: var(--profit); }
.trade-icon.loss   { background: var(--loss-bg);   color: var(--loss); }
.trade-icon svg { width: 18px; height: 18px; stroke-width: 2.25; }

.trade-info { min-width: 0; }

.trade-asset {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 7px;
}

.trade-direction {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  background: var(--bg-muted);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
}

.trade-time {
  font-size: 11.5px;
  color: var(--text-subtle);
  margin-top: 2px;
  font-weight: 500;
}

.trade-amount {
  font-family: 'JetBrains Mono', monospace;
  font-feature-settings: "tnum" 1;
  font-weight: 700;
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
}

.trade-amount.profit { color: var(--profit); }
.trade-amount.loss   { color: var(--loss); }

.trade-action {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--text-subtle);
  transition: background var(--duration-fast),
              color var(--duration-fast),
              opacity var(--duration-base),
              transform var(--duration-fast) var(--ease-spring);
  opacity: 0;
  flex-shrink: 0;
}

.trade-item:hover .trade-action { opacity: 1; }
.trade-action:hover {
  background: var(--loss-bg);
  color: var(--loss);
  transform: scale(1.1);
}
.trade-action:active { transform: scale(0.9); }
.trade-action svg { width: 15px; height: 15px; stroke-width: 2; }

/* ==========================================================================
   FORM
   ========================================================================== */
.field {
  margin-bottom: 20px;
  position: relative;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 7px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color var(--duration-fast);
}

/* Label sobe ao focar dentro do field */
.field:focus-within .field-label {
  color: var(--text);
}

.input, .select, .textarea {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: border-color var(--duration-base),
              box-shadow var(--duration-base),
              background var(--duration-base),
              color var(--duration-base);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.input:hover, .select:hover, .textarea:hover {
  border-color: var(--border-strong);
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3.5px rgba(0,0,0,0.07);
}

[data-theme="dark"] .input:focus,
[data-theme="dark"] .select:focus,
[data-theme="dark"] .textarea:focus {
  box-shadow: 0 0 0 3.5px rgba(255,255,255,0.07);
}

/* Valid state — input preenchido com valor válido */
.input:not(:placeholder-shown):not(:focus):valid {
  border-color: rgba(5,150,105,0.35);
  background: var(--bg-elevated);
}
[data-theme="dark"] .input:not(:placeholder-shown):not(:focus):valid {
  border-color: rgba(16,185,129,0.3);
}

.input::placeholder, .textarea::placeholder { color: var(--text-subtle); font-weight: 400; }
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
  cursor: pointer;
}

/* Field hint */
.field-hint {
  font-size: 11.5px;
  color: var(--text-subtle);
  margin-top: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Segmented */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  background: var(--bg-muted);
  padding: 5px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  transition: border-color var(--duration-base);
}

.segmented:focus-within {
  border-color: var(--border-strong);
}

.segmented-option { position: relative; cursor: pointer; }
.segmented-option input { position: absolute; opacity: 0; pointer-events: none; }

.segmented-option-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  transition: background var(--duration-base) var(--ease),
              color var(--duration-base) var(--ease),
              box-shadow var(--duration-base),
              transform var(--duration-fast) var(--ease-spring);
  user-select: none;
}

.segmented-option-label:hover {
  color: var(--text);
  background: rgba(0,0,0,0.03);
}
[data-theme="dark"] .segmented-option-label:hover {
  background: rgba(255,255,255,0.04);
}

.segmented-option input:checked + .segmented-option-label {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transform: scale(1.02);
}

.segmented-option input:checked + .segmented-option-label.profit {
  color: var(--profit);
  background: var(--profit-bg);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(5,150,105,0.15);
}
.segmented-option input:checked + .segmented-option-label.loss {
  color: var(--loss);
  background: var(--loss-bg);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(220,38,38,0.15);
}
[data-theme="dark"] .segmented-option input:checked + .segmented-option-label.profit {
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(16,185,129,0.15);
}
[data-theme="dark"] .segmented-option input:checked + .segmented-option-label.loss {
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(239,68,68,0.15);
}

.segmented-option-label svg {
  width: 16px; height: 16px;
  stroke-width: 2.25;
  transition: transform var(--duration-base) var(--ease-spring);
}
.segmented-option input:checked + .segmented-option-label svg {
  transform: scale(1.15);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: transform var(--duration-base) var(--ease),
              box-shadow var(--duration-base),
              background var(--duration-base),
              border-color var(--duration-base),
              opacity var(--duration-base);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

/* Ripple effect layer */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--duration-fast);
  pointer-events: none;
}
.btn:active::after {
  background: rgba(255,255,255,0.07);
}

.btn svg {
  width: 17px; height: 17px;
  stroke-width: 2.25;
  flex-shrink: 0;
  transition: transform var(--duration-base) var(--ease-spring);
}

.btn:hover svg { transform: scale(1.08); }
.btn:active svg { transform: scale(0.95); }

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.10) inset, var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: var(--shadow-md), 0 1px 0 rgba(255,255,255,0.10) inset;
}
.btn-primary:active { transform: scale(0.97) translateY(0); box-shadow: var(--shadow-xs); }

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: var(--bg-muted);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  transform: translateY(-1px);
}
.btn-ghost:active { transform: scale(0.97); }

.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-danger {
  background: var(--loss-bg);
  color: var(--loss);
  border: 1.5px solid rgba(220,38,38,0.2);
}
.btn-danger:hover {
  background: var(--loss);
  color: #fff;
  border-color: var(--loss);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .btn-danger:hover { color: #fff; }

.btn-block { width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 15px; border-radius: var(--r-lg); }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* Loading state — spinner dentro do btn */
.btn.loading {
  pointer-events: none;
  opacity: 0.75;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty {
  text-align: center;
  padding: 64px 24px;
  animation: emptyIn 0.5s var(--ease-out) both;
}

@keyframes emptyIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.empty-icon {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  color: var(--text-subtle);
  box-shadow: var(--shadow-xs);
  animation: emptyIconIn 0.6s var(--ease-spring) 0.1s both;
  transition: transform var(--duration-base) var(--ease-spring),
              box-shadow var(--duration-base);
}

@keyframes emptyIconIn {
  from { opacity: 0; transform: scale(0.7) rotate(-6deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.empty:hover .empty-icon {
  transform: translateY(-2px) rotate(-3deg);
  box-shadow: var(--shadow-sm);
}

.empty-icon svg { width: 26px; height: 26px; stroke-width: 1.5; }

.empty-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 260px;
  margin: 0 auto;
  line-height: 1.65;
}

.empty .btn {
  margin-top: 20px;
}

/* ==========================================================================
   TABS
   ========================================================================== */
.tabs {
  display: flex;
  gap: 3px;
  background: var(--bg-muted);
  padding: 4px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 1;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background var(--duration-base) var(--ease),
              color var(--duration-base) var(--ease),
              box-shadow var(--duration-base),
              transform var(--duration-fast) var(--ease);
  text-align: center;
  min-width: 60px;
  -webkit-tap-highlight-color: transparent;
}

.tab:not(.active):hover {
  color: var(--text);
  background: rgba(0,0,0,0.03);
}
[data-theme="dark"] .tab:not(.active):hover {
  background: rgba(255,255,255,0.04);
}

.tab:active { transform: scale(0.96); }

.tab.active {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   CALCULATOR
   ========================================================================== */
.calc-result {
  position: relative;
  overflow: hidden;
  background: var(--primary);
  color: var(--primary-text);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  margin-top: 24px;
  text-align: center;
  animation: calcIn 0.45s var(--ease-spring);
  box-shadow: var(--shadow-lg);
}

/* Shimmer sweep on result */
.calc-result::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -100%;
  width: 60%;
  height: 180%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transform: rotate(20deg);
  pointer-events: none;
  animation: shimmerSweep 2.5s var(--ease) 0.5s both;
}

@keyframes shimmerSweep {
  from { left: -100%; }
  to   { left: 160%; }
}

/* Subtle noise pattern on calc result */
.calc-result::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

@keyframes calcIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.calc-result-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.55;
  margin-bottom: 12px;
}

.calc-result-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.calc-result-unit {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.65;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

.calc-result-detail {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(128,128,128,0.18);
  font-size: 12px;
  opacity: 0.55;
  line-height: 1.75;
  position: relative;
  z-index: 1;
}

/* Pip info chip */
#pipInfo {
  transition: opacity var(--duration-base), transform var(--duration-base) var(--ease-spring);
}
#pipInfo:not([style*="none"]) {
  animation: chipIn 0.3s var(--ease-spring);
}
@keyframes chipIn {
  from { opacity: 0; transform: scale(0.85) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  /* Modals must sit above sidebar (100) and bottombar (100) */
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  transition: background var(--duration-slow), backdrop-filter var(--duration-slow);
}

.modal-backdrop.open {
  display: flex;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdropIn var(--duration-slow) var(--ease) both;
}

@keyframes backdropIn {
  from { background: rgba(0,0,0,0); backdrop-filter: blur(0px); }
  to   { background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); }
}

@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
}

.modal {
  background: var(--card-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding: 12px 24px 36px;
  width: 100%;
  max-width: 460px;
  max-height: 92dvh;
  overflow-y: auto;
  animation: sheetUp 0.35s var(--ease-spring);
  overscroll-behavior: contain;
  box-shadow: var(--shadow-xl);
  position: relative;
}

.modal::before {
  content: "";
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5) 50%, transparent);
  pointer-events: none;
}

[data-theme="dark"] .modal::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08) 50%, transparent);
}

@media (min-width: 640px) {
  .modal {
    border-radius: var(--r-2xl);
    padding: 28px 28px;
    max-height: 80vh;
    animation: modalPop 0.35s var(--ease-spring);
  }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-handle {
  width: 36px; height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto 20px;
}

@media (min-width: 640px) { .modal-handle { display: none; } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.modal-close {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  background: var(--bg-muted);
  transition: all 0.15s;
}

.modal-close:hover { background: var(--bg-subtle); color: var(--text); }
.modal-close svg { width: 16px; height: 16px; stroke-width: 2.25; }

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-160%);
  background: var(--primary);
  color: var(--primary-text);
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  z-index: 300;
  box-shadow: var(--shadow-xl);
  transition: transform 0.4s var(--ease-spring);
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(12px);
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast svg { width: 16px; height: 16px; stroke-width: 2.5; }

/* ==========================================================================
   BADGE
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge-profit { background: var(--profit-bg); color: var(--profit); }
.badge-loss   { background: var(--loss-bg);   color: var(--loss); }
.badge-neutral { background: var(--bg-muted); color: var(--text-muted); }

/* ==========================================================================
   ACCOUNT BADGES
   ========================================================================== */
.account-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.6;
}
.account-badge-financiada  { background: var(--accent-bg);  color: var(--accent); }
.account-badge-real        { background: var(--profit-bg);  color: var(--profit); }
.account-badge-treinamento { background: var(--warning-bg); color: var(--warning); }

/* ==========================================================================
   PHASE BADGE
   ========================================================================== */
.phase-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.6;
}
.phase-badge-1    { background: rgba(99,102,241,0.12); color: var(--accent); }
.phase-badge-2    { background: rgba(99,102,241,0.20); color: var(--accent); border: 1px solid rgba(99,102,241,0.3); }
.phase-badge-done { background: var(--profit-bg); color: var(--profit); }
[data-theme="dark"] .phase-badge-1 { background: rgba(129,140,248,0.12); }
[data-theme="dark"] .phase-badge-2 { background: rgba(129,140,248,0.20); border-color: rgba(129,140,248,0.3); }

/* ==========================================================================
   PHASE PROGRESS BAR
   ========================================================================== */
.phase-track {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--bg-subtle);
  overflow: hidden;
}

.phase-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--accent);
  transition: width 0.8s var(--ease-out);
}

.phase-fill.done {
  background: var(--profit);
}

@keyframes phaseFieldsIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   ACCOUNT CHIPS (historico filter)
   ========================================================================== */
.account-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  font-weight: 700;
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--duration-base) var(--ease);
  white-space: nowrap;
}
.account-chip:hover { border-color: var(--border-strong); color: var(--text); }
.account-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
}
.account-chip-accent.active   { background: var(--accent-bg);  border-color: var(--accent);  color: var(--accent); }
.account-chip-profit.active   { background: var(--profit-bg);  border-color: var(--profit);  color: var(--profit); }
.account-chip-warning.active  { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }

/* ==========================================================================
   ACCOUNT CARD (dashboard)
   ========================================================================== */
.account-card {
  transition: transform var(--duration-base) var(--ease),
              box-shadow var(--duration-base),
              border-color var(--duration-base);
}
.account-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-active-account {
  border-color: var(--profit) !important;
  box-shadow: 0 0 0 1px var(--profit), var(--shadow-sm) !important;
}

/* ==========================================================================
   SEGMENTED — ACCENT & WARNING VARIANTS
   ========================================================================== */
.segmented-option input:checked + .segmented-option-label.accent {
  color: var(--accent);
  background: var(--accent-bg);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(99,102,241,0.18);
}
.segmented-option input:checked + .segmented-option-label.warning {
  color: var(--warning);
  background: var(--warning-bg);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(217,119,6,0.18);
}
[data-theme="dark"] .segmented-option input:checked + .segmented-option-label.accent {
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(129,140,248,0.18);
}
[data-theme="dark"] .segmented-option input:checked + .segmented-option-label.warning {
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(245,158,11,0.18);
}

/* ==========================================================================
   HISTÓRICO — CABEÇALHO DE DIA
   ========================================================================== */
.hist-day-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0 10px;
}

.hist-day-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-shrink: 0;
}

.hist-day-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hist-day-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.hist-day-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-subtle);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 2px 8px;
  letter-spacing: 0.01em;
}

.hist-day-rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.hist-day-pnl {
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.hist-day-pnl.profit { color: var(--profit); }
.hist-day-pnl.loss   { color: var(--loss); }

/* ── Coluna de horário à esquerda de cada trade ── */
.hist-time-col {
  flex-shrink: 0;
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.hist-hour {
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ── Chip de resultado (Take / Stop) ── */
.hist-result-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.hist-result-chip.profit {
  background: var(--profit-bg);
  color: var(--profit);
}
.hist-result-chip.loss {
  background: var(--loss-bg);
  color: var(--loss);
}

/* ==========================================================================
   PHOTO ZONE (registro.php)
   ========================================================================== */
.photo-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color var(--duration-base), background var(--duration-base);
}
.photo-zone:hover { border-color: var(--accent); background: var(--accent-bg); }
.photo-zone.has-photo { cursor: default; min-height: 160px; padding: 0; }
.photo-zone.has-photo:hover { border-color: var(--border-strong); background: transparent; }

.photo-zone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px;
  color: var(--text-subtle);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
}
.photo-zone-prompt svg { width: 32px; height: 32px; opacity: 0.45; }

.photo-preview {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
  border-radius: calc(var(--r-md) - 2px);
}

.photo-remove {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  border: none;
  background: rgba(0,0,0,0.52);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background var(--duration-fast);
}
.photo-remove:hover { background: rgba(0,0,0,0.76); }
.photo-remove svg { width: 14px; height: 14px; stroke-width: 2.5; }

/* Modal trade photo */
.modal-photo {
  width: 100%;
  border-radius: var(--r-md);
  display: block;
  cursor: pointer;
  transition: opacity var(--duration-base);
}
.modal-photo:hover { opacity: 0.88; }

/* ==========================================================================
   DIVIDER
   ========================================================================== */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-1  { margin-bottom: 4px; }
.mb-2  { margin-bottom: 8px; }
.text-sm       { font-size: 13px; }
.text-xs       { font-size: 11.5px; }
.text-muted    { color: var(--text-muted); }
.text-subtle   { color: var(--text-subtle); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-extrabold{ font-weight: 800; }
.uppercase     { text-transform: uppercase; letter-spacing: 0.06em; }
.w-full        { width: 100%; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.7s linear infinite; }

/* ==========================================================================
   MODAL — CLOSE ANIMATION
   ========================================================================== */
.modal-backdrop.closing {
  display: flex;
  pointer-events: none;
  animation: backdropOut 0.3s var(--ease) both;
}

@keyframes backdropOut {
  from { background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  to   { background: rgba(0,0,0,0);   backdrop-filter: blur(0px);  -webkit-backdrop-filter: blur(0px); }
}

.modal-backdrop.closing .modal {
  animation: sheetDown 0.28s var(--ease) both;
}

@keyframes sheetDown {
  from { transform: translateY(0);   opacity: 1; }
  to   { transform: translateY(48px); opacity: 0; }
}

@media (min-width: 640px) {
  .modal-backdrop.closing .modal {
    animation: modalPopClose 0.25s var(--ease) both;
  }
}

@keyframes modalPopClose {
  from { transform: scale(1);    opacity: 1; }
  to   { transform: scale(0.95); opacity: 0; }
}

/* ==========================================================================
   TOAST — VARIANTS
   ========================================================================== */
.toast.error {
  background: var(--loss);
  color: #fff;
}

/* ==========================================================================
   LOGIN — FORM ENTER ANIMATION
   ========================================================================== */
.login-form-enter {
  animation: loginFormIn 0.22s var(--ease-out) both;
}

@keyframes loginFormIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Login card tagline */
.login-tagline {
  font-size: 13px;
  color: var(--text-subtle);
  text-align: center;
  margin-bottom: 32px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Login card footer */
.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 11.5px;
  color: var(--text-subtle);
  font-weight: 500;
}

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  position: relative;
  z-index: 1;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: 40px 36px 36px;
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
  animation: pageIn 0.5s var(--ease-out) both;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55) 50%, transparent);
  pointer-events: none;
}

[data-theme="dark"] .login-card::before {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08) 50%, transparent);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-bottom: 36px;
}

.login-logo-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--primary);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.login-logo-mark::after {
  content: "";
  width: 13px; height: 13px;
  background: var(--primary-text);
  border-radius: 3px;
}

.login-logo-text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.login-tabs {
  display: flex;
  background: var(--bg-muted);
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  padding: 4px;
  gap: 4px;
  margin-bottom: 28px;
}

.login-tab {
  flex: 1;
  padding: 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.25s var(--ease);
  text-align: center;
}

.login-tab.active {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-error {
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--loss-bg);
  border: 1px solid rgba(220,38,38,0.2);
  color: var(--loss);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  animation: pageIn 0.2s var(--ease-out) both;
}

/* ==========================================================================
   SIDEBAR — ACTIVE ACCOUNT
   ========================================================================== */
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  overflow: hidden;
}

.sidebar-account-dot {
  width: 24px; height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: 0;
  color: #fff;
}
.sidebar-account-dot-financiada  { background: var(--accent); }
.sidebar-account-dot-real        { background: var(--profit); }
.sidebar-account-dot-treinamento { background: var(--warning); }

.sidebar-account-name {
  font-size: 12px;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  min-width: 0;
}
.sidebar:hover .sidebar-account-name { opacity: 1; }

.sidebar-account-switch {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.2s var(--ease), background var(--duration-fast);
}
.sidebar:hover .sidebar-account-switch { opacity: 1; }
.sidebar-account-switch:hover { background: var(--bg-subtle); color: var(--text); }
.sidebar-account-switch svg { width: 14px; height: 14px; stroke-width: 2; }

/* ==========================================================================
   MOBILE ACCOUNT CHIP
   ========================================================================== */
.mobile-account-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--duration-base);
}
.mobile-account-chip:active { opacity: 0.7; }
.mobile-account-chip-financiada  { background: var(--accent-bg);  color: var(--accent); }
.mobile-account-chip-real        { background: var(--profit-bg);  color: var(--profit); }
.mobile-account-chip-treinamento { background: var(--warning-bg); color: var(--warning); }

/* ==========================================================================
   SELECIONAR CONTA — CARD
   ========================================================================== */
.selecionar-card {
  transition: transform var(--duration-base) var(--ease),
              box-shadow var(--duration-base),
              border-color var(--duration-base);
}
.selecionar-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.selecionar-card:active { transform: scale(0.99); }

.selecionar-card-active {
  border-color: var(--profit) !important;
  box-shadow: 0 0 0 1px var(--profit), var(--shadow-sm);
}

/* ==========================================================================
   SIDEBAR — USER SECTION
   ========================================================================== */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 2px;
}

.sidebar-user-avatar {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-text);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: 0;
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   HISTÓRICO — Redesign
   ========================================================================== */

/* Filter tabs */
.hfilters {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.hfilters::-webkit-scrollbar { display: none; }

.hfilter {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
  cursor: pointer;
}
.hfilter:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.hfilter.active {
  background: var(--primary);
  color: var(--primary-text);
  border-color: transparent;
}

/* Summary panel */
.hsummary {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 24px;
  display: grid;
  gap: 20px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hsummary-pnl {
  text-align: center;
}

.hsummary-amount {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.hsummary-amount.profit { color: var(--profit); }
.hsummary-amount.loss   { color: var(--loss); }

.hsummary-sublabel {
  font-size: 13px;
  color: var(--text-subtle);
  font-weight: 600;
}

/* Win rate bar */
.hsummary-winbar-wrap {
  display: grid;
  gap: 10px;
}

.hsummary-winbar {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--loss-bg);
  overflow: hidden;
}

.hsummary-winbar-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--profit);
  transition: width 0.6s var(--ease-out);
}

.hsummary-winbar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
}
.hsummary-winbar-labels .profit { color: var(--profit); }
.hsummary-winbar-labels .loss   { color: var(--loss); }
.hsummary-winbar-labels span:not(.profit):not(.loss) { color: var(--text-muted); }

/* Avg section */
.hsummary-avgs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hsummary-avg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--bg-muted);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.hsummary-avg-val {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
  font-family: 'JetBrains Mono', monospace;
}
.hsummary-avg-val.profit { color: var(--profit); }
.hsummary-avg-val.loss   { color: var(--loss); }

.hsummary-avg-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Day group */
.hday {
  margin-bottom: 8px;
}

.hday-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 10px;
}

.hday-hdr-left {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex: 1;
  min-width: 0;
}

.hday-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.hday-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle);
  white-space: nowrap;
}

.hday-hdr-mid {
  display: flex;
  gap: 5px;
  align-items: center;
}

.hday-w, .hday-l {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--r-full);
  letter-spacing: .02em;
}
.hday-w { background: var(--profit-bg); color: var(--profit); }
.hday-l { background: var(--loss-bg);   color: var(--loss); }

.hday-pnl {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}
.hday-pnl.profit { color: var(--profit); }
.hday-pnl.loss   { color: var(--loss); }

/* Trade list */
.hday-list {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

/* Trade card */
.htrade {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px 13px 16px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease),
              border-color var(--duration-fast);
  animation: fadeInUp var(--duration-slow) var(--ease-out) both;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.htrade:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}
.htrade:active { transform: scale(0.99); }

.htrade::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.htrade.profit::before { background: var(--profit); }
.htrade.loss::before   { background: var(--loss); }

/* Trade icon */
.htrade-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.htrade-icon svg { width: 16px; height: 16px; stroke-width: 2.5; }
.htrade-icon.profit { background: var(--profit-bg); color: var(--profit); }
.htrade-icon.loss   { background: var(--loss-bg);   color: var(--loss); }

/* Trade body */
.htrade-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.htrade-row1 {
  display: flex;
  align-items: center;
  gap: 7px;
}

.htrade-asset {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
}

.htrade-dir {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg-muted);
  color: var(--text-subtle);
  border: 1px solid var(--border);
  letter-spacing: .04em;
}

.htrade-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.htrade-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  letter-spacing: .01em;
}
.htrade-chip.profit { background: var(--profit-bg); color: var(--profit); }
.htrade-chip.loss   { background: var(--loss-bg);   color: var(--loss); }

.htrade-time {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-subtle);
  font-family: 'JetBrains Mono', monospace;
}

/* Trade right side */
.htrade-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.htrade-amount {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}
.htrade-amount.profit { color: var(--profit); }
.htrade-amount.loss   { color: var(--loss); }

.htrade-del {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--duration-fast), color var(--duration-fast);
  padding: 0;
}
.htrade-del svg { width: 13px; height: 13px; stroke-width: 2; }
.htrade-del:hover { background: var(--loss-bg); color: var(--loss); }

.sidebar:hover .sidebar-user-name { opacity: 1; }
