/* ============================================================
   La Nave Trading — Mobile-First v2
   Premium Dark Trading Terminal
   ============================================================ */

:root {
  --bg: #090c10;
  --bg2: #111820;
  --bg3: #192130;
  --border: #1e293b;
  --border2: #2d3a50;
  --text: #e2e8f0;
  --text2: #8899aa;
  --text3: #556677;
  --green: #00d4aa;
  --green-glow: rgba(0, 212, 170, 0.2);
  --green-bg: rgba(0, 212, 170, 0.1);
  --red: #f85149;
  --red-glow: rgba(248, 81, 73, 0.2);
  --red-bg: rgba(248, 81, 73, 0.1);
  --blue: #58a6ff;
  --blue-glow: rgba(88, 166, 255, 0.15);
  --gold: #f0b90b;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --glass: rgba(17, 24, 32, 0.85);
  --glass-border: rgba(255,255,255,0.06);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-font-smoothing: antialiased;
}
body {
  font-family: var(--font); background: var(--bg);
  color: var(--text); font-size: 14px; line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(0,212,170,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(88,166,255,0.03) 0%, transparent 50%);
}

/* ==================== SCREENS ==================== */
.screen { display: none; position: fixed; inset: 0; }
.screen.active { display: flex; }

/* ==================== LOGIN ==================== */
#login-screen {
  flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(0,212,170,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 80%, rgba(88,166,255,0.04) 0%, transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-wrap { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 40px; }
.login-icon {
  margin-bottom: 20px; display: inline-flex;
  filter: drop-shadow(0 0 20px rgba(0,212,170,0.3));
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.login-brand h1 {
  font-size: 26px; font-weight: 800;
  background: linear-gradient(135deg, var(--text) 0%, var(--green) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: -0.02em;
}

/* ==================== FORMS ==================== */
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 11px; color: var(--text2);
  margin-bottom: 8px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field input, .field select {
  width: 100%; padding: 14px 16px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font); font-size: 15px;
  -webkit-appearance: none; appearance: none;
  transition: all var(--transition);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}
.field input::placeholder { color: var(--text3); }
.field-check label {
  display: flex; align-items: center; gap: 10px; margin: 0;
  text-transform: none; font-size: 14px; cursor: pointer; color: var(--text);
}
.field-check input[type="checkbox"] {
  width: 22px; height: 22px; accent-color: var(--green); cursor: pointer;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all var(--transition); white-space: nowrap;
  position: relative; overflow: hidden;
}
.btn-primary {
  background: linear-gradient(135deg, #00c49d, var(--green));
  color: #0d1117; box-shadow: 0 2px 12px var(--green-glow);
}
.btn-primary:hover, .btn-primary:active {
  filter: brightness(1.1); transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--green-glow);
}
.btn-danger {
  background: linear-gradient(135deg, #e0483f, var(--red));
  color: #fff; box-shadow: 0 2px 12px var(--red-glow);
}
.btn-danger:hover, .btn-danger:active {
  filter: brightness(1.1); transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--red-glow);
}
.btn-ghost {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:active { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 16px; border-radius: var(--radius); font-weight: 700; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn:disabled { opacity: 0.4; pointer-events: none; filter: none; transform: none; }

/* ==================== MAIN CONTENT ==================== */
#main-content { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.page { display: none; flex-direction: column; min-height: 100%; }
.page.active { display: flex; animation: pageIn 0.25s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-pad { padding: 16px 14px; padding-bottom: calc(16px + 110px); }

/* ==================== SECTION HEADER ==================== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 14px;
}
.section-header h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text3); font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.section-header h3 span {
  background: var(--bg3); padding: 3px 10px; border-radius: 12px;
  font-size: 10px; color: var(--text2); font-weight: 600;
}

/* ==================== INICIO ==================== */

/* ── Welcome ── */
.welcome-row {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0 14px;
  position: relative; z-index: 2;
  background: transparent; border: none; box-shadow: none;
}
.welcome-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px; color: var(--text); flex-shrink: 0;
  box-shadow: 0 4px 20px var(--green-glow);
  position: relative; z-index: 1;
}
.welcome-avatar::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: rgba(0,212,170,0.5); border-right-color: rgba(0,212,170,0.3);
  animation: avatarSpin 4s linear infinite;
}
@keyframes avatarSpin { to { transform: rotate(360deg); } }
.welcome-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; position: relative; z-index: 1; color: var(--text); }
.welcome-role {
  font-size: 11px; color: var(--text2); margin-top: 3px;
  padding: 3px 10px; background: var(--bg3); border-radius: 10px;
  display: inline-block; font-weight: 500; letter-spacing: 0.03em;
  position: relative; z-index: 1;
}

/* ── Inicio decorative header background ── */
#app-screen::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 420px;
  background: var(--green);
  border-radius: 0 0 60% 70% / 0 0 60px 80px;
  z-index: 0; pointer-events: none;
}

/* ── Section title ── */
.inicio-section-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text3); font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.inicio-section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Balance Cards — Stack + Swap ── */
.balance-cards {
  position: relative; min-height: 250px;
  margin-bottom: 20px; z-index: 1;
}

.bal-card {
  background: linear-gradient(180deg, var(--bg2) 0%, rgba(17,24,32,0.97) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px 24px;
  min-height: 140px;
  box-shadow: var(--shadow-card);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: absolute; left: 0; right: 0; overflow: hidden;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}

/* Front card (default: Nave Capital) */
.bal-card:nth-child(1) {
  z-index: 2; top: 0;
  opacity: 1; transform: scale(1);
}
/* Back card (default: Trading) */
.bal-card:nth-child(2) {
  z-index: 1; top: 100px;
  opacity: 0.72;
  transform: scale(0.9);
  filter: brightness(0.75) blur(0.5px);
}

/* SWAPPED: Trading goes front, Nave Capital goes back */
.balance-cards.swapped .bal-card:nth-child(1) {
  z-index: 1; top: 100px;
  opacity: 0.72;
  transform: scale(0.9);
  filter: brightness(0.75) blur(0.5px);
}
.balance-cards.swapped .bal-card:nth-child(2) {
  z-index: 3; top: 0;
  opacity: 1;
  transform: scale(1);
  filter: brightness(1) blur(0);
  box-shadow: var(--shadow-lg);
}

/* Title ribbon inside card top */
.bal-card::before {
  content: '';
  position: absolute; top: 14px; left: 16px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700; color: #fff;
  background: var(--bg3); border: 1px solid var(--border);
  padding: 4px 14px; border-radius: 12px; z-index: 5;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.bal-card:nth-child(1)::before {
  content: '🏦 NAVE CAPITAL';
  border-color: rgba(88,166,255,0.3);
}
.bal-card:nth-child(2)::before {
  content: '📈 TRADING';
  border-color: rgba(0,212,170,0.3);
}

/* Gradiente top line */
.bal-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.bal-card:nth-child(1)::after {
  background: linear-gradient(90deg, var(--blue), rgba(88,166,255,0.4), transparent);
}
.bal-card:nth-child(2)::after {
  background: linear-gradient(90deg, var(--green), rgba(0,212,170,0.4), transparent);
}

/* Hover hint on back card */
.bal-card:nth-child(2):hover:not(.balance-cards.swapped .bal-card:nth-child(2)),
.balance-cards.swapped .bal-card:nth-child(1):hover {
  filter: brightness(0.85) blur(0px) !important;
  opacity: 0.85 !important;
}

/* Labels & values */
.bal-card .bal-label {
  font-size: 10px; color: var(--text3); text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700;
  transition: all var(--transition);
  margin-top: 22px;
}
.bal-card .bal-value {
  font-size: 30px; font-weight: 800; margin-top: 4px;
  font-family: var(--mono); letter-spacing: -0.03em; line-height: 1;
  transition: all var(--transition);
}
.bal-card .bal-value.nave { color: var(--blue); }
.bal-card .bal-value.trading { color: var(--green); }

/* ── Quick Stats ── */
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; position: relative; z-index: 1; }
.qstat {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 10px; text-align: center;
  box-shadow: var(--shadow-card); transition: all var(--transition);
  position: relative; overflow: hidden;
}
.qstat::before {
  content: ''; position: absolute; bottom: 0; left: 20%; right: 20%; height: 2px;
  border-radius: 2px 2px 0 0; transition: all var(--transition);
}
.qstat:first-child::before { background: linear-gradient(90deg, transparent, rgba(88,166,255,0.4), transparent); }
.qstat:nth-child(2)::before { background: linear-gradient(90deg, transparent, rgba(240,185,11,0.4), transparent); }
.qstat:last-child::before { background: linear-gradient(90deg, transparent, rgba(0,212,170,0.4), transparent); }
.qstat .qs-val {
  font-size: 20px; font-weight: 800; font-family: var(--mono);
  letter-spacing: -0.02em; position: relative; display: inline-block;
}
.qstat .qs-val.up { color: var(--green); }
.qstat .qs-val.up::after { content: ' ↑'; font-size: 14px; }
.qstat .qs-val.down { color: var(--red); }
.qstat .qs-val.down::after { content: ' ↓'; font-size: 14px; }
.qstat .qs-val:not(.up):not(.down) { color: var(--text); }
.qstat .qs-lbl {
  font-size: 10px; color: var(--text3); text-transform: uppercase;
  font-weight: 700; margin-top: 6px; letter-spacing: 0.06em;
}
/* Icon indicators for each stat */
.qstat:first-child .qs-lbl::before { content: '📊 '; }
.qstat:nth-child(2) .qs-lbl::before { content: '🎯 '; }
.qstat:last-child .qs-lbl::before { content: '💵 '; }

/* ── Recent Trades ── */
.recent-trades-mini {
  display: flex; flex-direction: row; gap: 8px;
  overflow-x: auto; padding-top: 28px; padding-bottom: 8px;
  -webkit-overflow-scrolling: touch; position: relative;
}
.recent-trades-mini::before {
  content: 'TRADES RECIENTES';
  position: absolute; top: 0; left: 0; z-index: 5;
  font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text); font-weight: 700;
  background: var(--bg); padding-right: 16px; padding-bottom: 4px;
  pointer-events: none;
}
.mini-trade {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 18px; min-width: 130px; min-height: 70px;
  font-family: var(--mono); font-size: 13px; flex-shrink: 0;
  box-shadow: var(--shadow-card); transition: all var(--transition);
  position: relative; overflow: hidden;
}
.mini-trade::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--border2);
}
.mini-trade:hover {
  border-color: var(--border2);
  transform: translateX(3px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.mini-trade:active { background: var(--bg3); }
.mini-trade span:first-child { font-weight: 600; font-size: 14px; }
.mini-trade span:last-child { font-size: 16px; font-weight: 700; }

/* ==================== TRADING PAGE LAYOUT ==================== */
#page-trading { height: 100%; flex-direction: column; }

/* ==================== TRADING TOP ==================== */
.trading-top {
  padding: 10px 14px 8px; background: var(--bg2);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  box-shadow: 0 1px 8px rgba(0,0,0,0.2);
}
.sym-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sym-select {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 30px 8px 12px; font-family: var(--mono); font-size: 14px; font-weight: 700;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238899aa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  cursor: pointer; transition: all var(--transition);
}
.sym-select:focus { border-color: var(--green); outline: none; }
.price-now { text-align: right; display: flex; align-items: center; gap: 8px; }
.price-big { font-family: var(--mono); font-size: 22px; font-weight: 800; display: block; line-height: 1.2; letter-spacing: -0.02em; }
.price-big.up { color: var(--green); }
.price-big.down { color: var(--red); }

/* Live pulse indicator */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  display: inline-block; flex-shrink: 0;
  box-shadow: 0 0 8px var(--green);
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--green); }
  50% { opacity: 0.5; box-shadow: 0 0 12px var(--green); }
}

.price-spread { font-family: var(--mono); font-size: 10px; color: var(--text3); display: block; }

.timeframe-pills { display: flex; gap: 3px; }
.tf-pill {
  flex: 1; padding: 8px 0; border: 1px solid var(--border); background: transparent;
  color: var(--text2); font-family: var(--mono); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); text-align: center; border-radius: var(--radius-xs);
  letter-spacing: 0.02em;
}
.tf-pill:hover { border-color: var(--border2); color: var(--text); }
.tf-pill.active {
  background: linear-gradient(135deg, var(--green), #00a884);
  color: #0d1117; border-color: var(--green); font-weight: 700;
  box-shadow: 0 2px 8px var(--green-glow);
}

/* ==================== CHART ==================== */
.chart-card {
  flex: 1; margin: 8px 12px; min-height: 220px;
  background: #060a10; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3), var(--shadow-card);
}
.chart-wrap { position: relative; width: 100%; height: 100%; background: #060a10; }
.chart-wrap canvas { display: block; width: 100%; height: 100%; }
.chart-overlay {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: rgba(6,10,16,0.9); z-index: 2;
  gap: 12px; color: var(--text2); font-size: 13px; font-weight: 500;
  backdrop-filter: blur(2px);
}
.chart-watermark {
  position: absolute; bottom: 8px; right: 12px;
  color: var(--text3); font-size: 10px; font-family: var(--mono);
  pointer-events: none; z-index: 1; opacity: 0.35;
}

/* ==================== ORDER PANEL ==================== */
.order-panel {
  padding: 10px 12px; flex-shrink: 0;
  padding-bottom: calc(10px + var(--safe-bottom));
  background: var(--bg);
}
.order-buttons { display: flex; align-items: stretch; gap: 8px; }
.order-btn {
  flex: 1.2; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px;
  padding: 16px 8px; border: none; border-radius: var(--radius);
  font-family: var(--font); cursor: pointer; transition: all var(--transition);
  position: relative; overflow: hidden;
}
.order-btn::after {
  content: ''; position: absolute; inset: 0;
  opacity: 0; transition: opacity var(--transition);
}
.order-btn.buy {
  background: linear-gradient(135deg, #00c49d, #00e6b4);
  color: #0d1117; box-shadow: 0 4px 16px var(--green-glow);
}
.order-btn.sell {
  background: linear-gradient(135deg, #e0483f, #ff5e55);
  color: #fff; box-shadow: 0 4px 16px var(--red-glow);
}
.order-btn:active { transform: scale(0.95); filter: brightness(1.1); }
.ob-label { font-size: 16px; font-weight: 800; letter-spacing: 0.06em; position: relative; z-index: 1; }
.ob-price { font-size: 11px; opacity: 0.8; font-family: var(--mono); font-weight: 500; position: relative; z-index: 1; }
.order-inputs { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.oi-field {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 8px;
  transition: border-color var(--transition);
}
.oi-field:focus-within { border-color: var(--border2); }
.oi-field label {
  font-size: 9px; color: var(--text3); text-transform: uppercase;
  font-weight: 700; min-width: 18px; letter-spacing: 0.04em;
}
.oi-field input {
  flex: 1; border: none; background: transparent; color: var(--text);
  font-family: var(--mono); font-size: 14px; padding: 10px 0; text-align: right;
  -webkit-appearance: none; font-weight: 500;
}
.oi-field input:focus { outline: none; }
.oi-field input::placeholder { color: var(--text3); }

/* ==================== POSITIONS ==================== */
.positions-section { padding: 0 12px 10px; flex-shrink: 0; }
.collapsible { cursor: pointer; }
.collapsible:active { opacity: 0.7; }
.collapse-arrow { transition: transform 0.25s ease; color: var(--text3); flex-shrink: 0; }
.collapse-arrow.open { transform: rotate(180deg); }

.positions-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
.position-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  transition: all var(--transition); cursor: pointer;
  box-shadow: var(--shadow-card); position: relative; overflow: hidden;
}
.position-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 3px 0 0 3px;
}
.position-card.win::before { background: var(--green); }
.position-card.loss::before { background: var(--red); }
.position-card:active { background: var(--bg3); border-color: var(--border2); transform: translateY(-1px); }
.pos-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pos-symbol { font-weight: 700; font-family: var(--mono); font-size: 14px; letter-spacing: -0.01em; }
.pos-dir {
  font-size: 10px; padding: 3px 9px; border-radius: 4px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.pos-dir.buy { background: var(--green-bg); color: var(--green); border: 1px solid rgba(0,212,170,0.2); }
.pos-dir.sell { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248,81,73,0.2); }
.pos-details { font-family: var(--mono); font-size: 11px; color: var(--text2); display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
.pos-profit { font-weight: 700; font-family: var(--mono); font-size: 14px; margin-top: 4px; letter-spacing: -0.01em; }
.pos-profit.win { color: var(--green); }
.pos-profit.loss { color: var(--red); }

/* ==================== POSITION EDIT MODAL ==================== */
.pos-info-strip {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  background: var(--bg3); border-radius: var(--radius-sm); padding: 14px 16px;
  margin-bottom: 18px; font-family: var(--mono); font-size: 13px;
  border: 1px solid var(--border);
}
.pos-info-strip .pi-item { display: flex; flex-direction: column; gap: 3px; }
.pos-info-strip .pi-label { font-size: 9px; color: var(--text3); text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; }
.pos-info-strip .pi-value { font-weight: 600; color: var(--text); }

.sl-tp-block {
  background: var(--bg3); border-radius: var(--radius); padding: 16px;
  margin-bottom: 14px; border: 1px solid var(--border);
}
.sl-tp-block h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text3); margin-bottom: 12px; font-weight: 700;
}
.sl-tp-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.st-tab {
  flex: 1; padding: 8px 0; border: 1px solid var(--border); background: transparent;
  color: var(--text2); font-family: var(--font); font-size: 11px; cursor: pointer;
  transition: all var(--transition); border-radius: var(--radius-xs); font-weight: 500;
}
.st-tab:hover { border-color: var(--border2); color: var(--text); }
.st-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 2px 8px var(--blue-glow); }
.st-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.st-input {
  display: none; flex: 1; padding: 12px 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--mono); font-size: 14px; -webkit-appearance: none;
}
.st-input.active { display: block; }
.st-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 2px var(--green-glow); }
.st-input::placeholder { color: var(--text3); }
.st-hint { font-size: 11px; color: var(--text3); margin-bottom: 10px; font-family: var(--mono); }

/* ==================== HISTORIAL ==================== */
.trades-filter { display: flex; gap: 10px; margin-bottom: 14px; }
.filter-input {
  flex: 1; padding: 12px 14px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--mono); font-size: 13px;
  -webkit-appearance: none; outline: none; transition: all var(--transition);
}
.filter-input:focus { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-glow); }
.filter-select {
  padding: 12px 30px 12px 14px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 13px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238899aa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  cursor: pointer; transition: all var(--transition);
}
.filter-select:focus { border-color: var(--green); outline: none; }
.trades-summary {
  display: flex; gap: 16px; margin-bottom: 14px;
  font-family: var(--mono); font-size: 12px; color: var(--text2);
  background: var(--bg2); padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.trades-list { display: flex; flex-direction: column; gap: 8px; }
.trade-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; font-family: var(--mono); font-size: 12px; gap: 4px;
  box-shadow: var(--shadow-card); transition: all var(--transition);
  position: relative; overflow: hidden;
}
.trade-row::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.trade-row.win::before { background: var(--green); }
.trade-row.loss::before { background: var(--red); }
.trade-row .tr-pair { font-weight: 600; font-size: 13px; }
.trade-row .tr-meta { color: var(--text2); font-size: 11px; }
.trade-row .tr-profit { font-weight: 700; font-size: 14px; text-align: right; }
.trade-row .tr-profit.win { color: var(--green); }
.trade-row .tr-profit.loss { color: var(--red); }

/* ==================== TRANSFERIR ==================== */
.transfer-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.transfer-form { display: flex; flex-direction: column; gap: 16px; }
.transfer-dir { display: flex; gap: 10px; }
.td-btn {
  flex: 1; padding: 16px 10px; background: var(--bg2); border: 2px solid var(--border);
  border-radius: var(--radius); color: var(--text2); cursor: pointer;
  font-family: var(--font); text-align: center; transition: all var(--transition);
  box-shadow: var(--shadow-card);
}
.td-btn:hover { border-color: var(--border2); }
.td-btn .td-label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.td-btn .td-desc { font-size: 10px; color: var(--text3); }
.td-btn.active {
  border-color: var(--green); color: var(--text); background: var(--green-bg);
  box-shadow: 0 0 16px var(--green-glow);
}

/* ==================== ADMIN ==================== */
.admin-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px; }
.stat-tile {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-align: center; box-shadow: var(--shadow-card); transition: all var(--transition);
}
.stat-tile .stat-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-tile .stat-value { font-size: 18px; font-weight: 800; margin-top: 4px; font-family: var(--mono); }
.stat-tile .stat-value.up { color: var(--green); }
.stat-tile .stat-value.down { color: var(--red); }

.admin-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg2); }
.atab {
  flex: 1; padding: 12px 0; background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text2); font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.atab:hover { color: var(--text); }
.atab.active { color: var(--green); border-bottom-color: var(--green); }
.atab-content { display: none; flex: 1; overflow: auto; }
.atab-content.active { display: flex; flex-direction: column; }

.table-actions { padding: 12px; }
.table-wrap { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead { position: sticky; top: 0; z-index: 2; }
th {
  background: var(--bg3); padding: 10px 12px; text-align: left;
  font-weight: 700; color: var(--text3); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
  border-bottom: 2px solid var(--border);
}
td {
  padding: 12px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; font-family: var(--mono); font-size: 12px;
  transition: background var(--transition);
}
tr:hover td { background: rgba(255,255,255,0.015); }
tr:active td { background: rgba(0,212,170,0.03); }

/* ==================== FORM UTILS ==================== */
.form-error {
  color: var(--red); font-size: 12px; padding: 12px 14px;
  background: var(--red-bg); border-radius: var(--radius-sm);
  margin: 8px 0; border: 1px solid rgba(248,81,73,0.2);
  font-weight: 500;
}
.form-success {
  color: var(--green); font-size: 12px; padding: 12px 14px;
  background: var(--green-bg); border-radius: var(--radius-sm);
  margin: 8px 0; border: 1px solid rgba(0,212,170,0.2);
  font-weight: 500;
}
.empty-state {
  text-align: center; color: var(--text3); padding: 36px 20px;
  font-size: 13px; font-weight: 500;
}

/* ==================== FLOATING BUBBLE ==================== */
.bubble-container { position: fixed; bottom: calc(28px + var(--safe-bottom)); right: 20px; z-index: 50; }
.bubble-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px); z-index: 45; display: none; opacity: 0; transition: opacity 0.3s ease;
}
.bubble-overlay.show { display: block; opacity: 1; }

.bubble-fab {
  width: 58px; height: 58px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--green), #00a884);
  color: #0d1117;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 24px rgba(0,212,170,0.35);
  transition: all var(--transition); position: relative; z-index: 51;
}
.bubble-fab:active { transform: scale(0.9); }
.bubble-fab .fab-icon-close { display: none; }
.bubble-fab.open {
  background: var(--bg3); color: var(--text);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.bubble-fab.open .fab-icon-menu { display: none; }
.bubble-fab.open .fab-icon-close { display: block; }

.bubble-menu {
  position: absolute; bottom: 70px; right: 0;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: var(--radius); padding: 10px 0; min-width: 210px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  display: none; flex-direction: column;
  transform-origin: bottom right;
  animation: bubbleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}
.bubble-menu.open { display: flex; }
@keyframes bubbleIn {
  from { opacity: 0; transform: scale(0.8) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.bubble-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 20px; background: transparent; border: none;
  color: var(--text); font-family: var(--font); font-size: 14px;
  cursor: pointer; transition: all var(--transition); width: 100%; text-align: left;
  font-weight: 500;
}
.bubble-item:hover { background: rgba(255,255,255,0.03); }
.bubble-item:active { background: rgba(0,212,170,0.08); }
.bubble-item svg { flex-shrink: 0; opacity: 0.6; transition: opacity var(--transition); }
.bubble-item:active svg { opacity: 1; }
.bubble-divider { height: 1px; background: var(--glass-border); margin: 6px 16px; }
.bubble-logout { color: var(--red) !important; }

/* ==================== MODAL (bottom sheet) ==================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px); display: flex; align-items: flex-end;
  justify-content: center; z-index: 100;
}
.modal-sheet {
  background: var(--bg2); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 520px; max-height: 90vh;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.7);
  display: flex; flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border);
  border-bottom: none;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 40px; height: 5px; background: var(--border2);
  border-radius: 3px; margin: 12px auto 0; opacity: 0.6;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2);
  font-size: 20px; cursor: pointer; padding: 0; line-height: 1;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all var(--transition);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border);
  padding-bottom: calc(16px + var(--safe-bottom));
}

/* ==================== SPINNER ==================== */
.spinner {
  width: 22px; height: 22px; border: 2.5px solid var(--border);
  border-top-color: var(--green); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ==================== TABLET ==================== */
@media (min-width: 768px) {
  .login-wrap { max-width: 420px; }
  .login-brand h1 { font-size: 28px; }

  #page-trading { max-width: 720px; margin: 0 auto; }
  .chart-card { margin: 10px 0; min-height: 350px; }
  .order-panel { padding: 12px 0; }
  .order-inputs { flex-direction: row; gap: 8px; }
  .oi-field { flex: 1; }
  .order-btn { padding: 18px 12px; }

  .admin-stats-row { grid-template-columns: repeat(6, 1fr); }
  .balance-cards { gap: 14px; }
  .quick-stats { gap: 12px; }

  .position-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    border-color: var(--border2);
  }
  .trade-row:hover {
    transform: translateX(2px);
    border-color: var(--border2);
  }
}
