:root {
  --bg: #131722;
  --bg-deep: #0b0f17;
  --panel: #1a1f2c;
  --panel-2: #212736;
  --border: #2a3040;
  --text: #d9dde8;
  --text-dim: #8089a0;
  --up: #039C55;
  --down: #F6465D;
  --cyan: #B58A3C;
  --cyan-soft: rgba(181, 138, 60, 0.14);
  --cyan-glow: rgba(181, 138, 60, 0.35);
  --gold: #8A6420;
  --gold-soft: rgba(138, 100, 32, 0.14);
  --accent: var(--cyan);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 58px;
}

* { box-sizing: border-box; }
button { font-family: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: var(--safe-top);
  background: var(--bg);
}

/* ---- header ---- */
header#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(180deg, #0b0f17 0%, #10151f 100%);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, var(--cyan), transparent 45%, var(--gold)) 1;
  flex-shrink: 0;
}
header#topbar .brand { display: flex; align-items: center; gap: 10px; }
header#topbar .brand img {
  width: 30px; height: 30px; border-radius: 8px;
  box-shadow: 0 0 10px var(--cyan-glow);
}
header#topbar h1 {
  margin: 0;
  font-family: Rajdhani, Inter, sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 1.4px;
  color: #e9edf6;
}
header#topbar h1 .accent {
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
#conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 8px var(--up);
}
.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--panel); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 10px;
  transition: all .15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { color: var(--cyan); border-color: var(--cyan); }

/* ---- symbol bar ---- */
#symbol-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  flex-shrink: 0;
}
#symbol-bar .left { display: flex; align-items: center; gap: 10px; min-width: 0; }
#symbol-picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 12px;
  padding: 7px 10px 7px 8px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 62vw;
  transition: border-color .15s, box-shadow .15s;
}
#symbol-picker-btn:active { border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan-glow); }
#symbol-picker-btn #cur-symbol { overflow: hidden; text-overflow: ellipsis; }
#symbol-picker-btn .chev { width: 14px; height: 14px; color: var(--cyan); flex-shrink: 0; }
#symbol-picker-btn .broker-tag {
  color: var(--gold);
  background: var(--gold-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .4px;
  border: 1px solid rgba(255,179,0,.5);
  border-radius: 6px;
  padding: 2px 5px;
}
.price-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
#price-text { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
#price-text.up { color: var(--up); text-shadow: 0 0 12px rgba(3,156,85,.45); }
#price-text.down { color: var(--down); text-shadow: 0 0 12px rgba(246,70,93,.45); }
#timers-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
}
.timer-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #a0aec0;
  background: rgba(160, 174, 192, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(160, 174, 192, 0.15);
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.timer-pill::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 5px var(--gold);
  animation: pulse-dot 1.5s infinite ease-in-out;
}
.timer-pill.active-pane-timer {
  border-color: rgba(181, 138, 60, 0.45);
  background: rgba(181, 138, 60, 0.10);
  color: #e2e8f0;
}
.timer-pill .timer-num {
  font-size: 9px;
  font-weight: 800;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}
.timer-pill.active-pane-timer .timer-num {
  background: var(--cyan);
  color: #0b0f17;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ---- timeframe pills ---- */
#tf-row {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
#tf-row::-webkit-scrollbar { display: none; }
.tf-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 700;
  flex: 1 0 auto;
  text-align: center;
  white-space: nowrap;
  transition: all .15s;
}
.tf-pill.active {
  background: var(--cyan-soft);
  border-color: rgba(181, 138, 60,.55);
  color: var(--cyan);
  box-shadow: 0 0 10px rgba(181, 138, 60,.18) inset;
}

/* ---- chart layout & dual pane split ---- */
#chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
#charts-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg);
}
#charts-container.layout-split {
  flex-direction: column;
}
@media (min-width: 800px) and (orientation: landscape) {
  #charts-container.layout-split {
    flex-direction: row;
  }
}
.chart-pane {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(42, 48, 64, 0.4);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #0b0f17;
}
.chart-pane.active {
  border-color: rgba(181, 138, 60, 0.5);
  box-shadow: 0 0 12px rgba(181, 138, 60, 0.15) inset;
}
.chart-box {
  width: 100%;
  height: 100%;
}
.pane-badge {
  position: absolute;
  top: 8px;
  left: 54px;
  z-index: 4;
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(16, 21, 31, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
#charts-container.layout-split .pane-badge {
  display: flex;
}
.pane-badge .pane-num {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 10px;
  background: var(--panel-2);
  color: var(--text-dim);
}
.chart-pane.active .pane-badge {
  border-color: rgba(181, 138, 60, 0.55);
  box-shadow: 0 0 8px rgba(181, 138, 60, 0.2);
}
.chart-pane.active .pane-badge .pane-num {
  background: var(--cyan);
  color: #0b0f17;
  font-weight: 800;
}
.pane-badge .pane-sym {
  color: #fff;
}
.pane-badge .pane-tf {
  color: var(--gold);
  font-size: 10px;
}

#chart-status {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  background: rgba(244,67,54,0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 10px;
  display: none;
  z-index: 6;
}
#chart-status.show { display: block; }

/* ---- barra de herramientas de dibujo (izquierda, colapsable, por panel) ---- */
.draw-tools {
  position: absolute;
  left: 6px; top: 8px;
  z-index: 5;
  display: flex; flex-direction: column; gap: 4px;
  padding: 5px;
  background: rgba(16, 21, 31, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
  transition: all .2s ease;
}
.draw-tools.minimized {
  padding: 3px;
  background: rgba(16, 21, 31, 0.72);
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.draw-tools.minimized .draw-tools-items {
  display: none;
}
.toggle-tools-btn {
  width: 38px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  border: 0;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 2px;
  transition: all 0.15s;
}
.toggle-tools-btn:active {
  color: var(--cyan);
  background: var(--cyan-soft);
}
.toggle-tools-btn svg {
  width: 14px;
  height: 14px;
}
.draw-tools.minimized .toggle-tools-btn {
  width: 32px;
  height: 32px;
  margin-bottom: 0;
  border-radius: 10px;
}
.draw-tools.minimized .toggle-tools-btn .icon-collapse {
  display: none;
}
.draw-tools:not(.minimized) .toggle-tools-btn .icon-expand {
  display: none;
}

#btn-split.active, #btn-link.active {
  color: var(--cyan);
  border-color: rgba(181, 138, 60, 0.55);
  box-shadow: 0 0 10px rgba(181, 138, 60, 0.25);
}

.tool-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 10px;
  transition: all .15s;
}

.tool-btn svg { width: 20px; height: 20px; }
.tool-btn.active {
  color: var(--cyan);
  background: var(--cyan-soft);
  border-color: rgba(181, 138, 60,.5);
  box-shadow: 0 0 10px rgba(181, 138, 60,.2);
}
.tool-btn.danger:active { color: var(--down); }
.tool-btn:active { transform: scale(.92); }
#tool-hint {
  position: absolute;
  left: 50%; bottom: 12px;
  transform: translateX(-50%);
  background: rgba(16,21,31,.92);
  color: var(--gold);
  border: 1px solid rgba(255,179,0,.5);
  font-size: 12px; font-weight: 600;
  padding: 6px 12px;
  border-radius: 14px;
  display: none;
  z-index: 6;
  white-space: nowrap;
}
#tool-hint.show { display: block; }

/* ---- navegacion inferior ---- */
#bottom-nav {
  display: flex;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(0deg, #0b0f17 0%, #10151f 100%);
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, var(--gold), transparent 50%, var(--cyan)) 1;
  flex-shrink: 0;
}
.nav-btn {
  flex: 1;
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: transparent; border: 0;
  color: var(--text-dim);
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  transition: color .15s;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active, .nav-btn:active { color: var(--cyan); }
.nav-btn.active::before {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  box-shadow: 0 0 8px var(--cyan-glow);
}
.nav-btn .badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 16px; height: 16px; padding: 0 4px;
  font-style: normal; font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
  background: var(--gold); color: #111; border-radius: 8px;
  display: none;
}
.nav-btn .badge.show { display: block; }

/* ---- hojas inferiores (activos / indicadores) ---- */
#picker-overlay, #ind-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 50;
}
#picker-overlay.show, #ind-overlay.show { display: block; }
#picker-sheet, #ind-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 84vh;
  background: linear-gradient(180deg, #171c28 0%, #0f131c 100%);
  border-top: 1px solid rgba(181, 138, 60,.45);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(181, 138, 60,.12);
  display: flex;
  flex-direction: column;
  z-index: 51;
  padding-bottom: var(--safe-bottom);
  transform: translateY(100%);
  transition: transform 0.22s ease;
}
#picker-overlay.show #picker-sheet, #ind-overlay.show #ind-sheet { transform: translateY(0); }
.sheet-title {
  font-family: Rajdhani, Inter, sans-serif;
  font-weight: 700; font-size: 18px; letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 16px 6px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ind-pane-tabs {
  display: flex;
  gap: 8px;
  padding: 4px 14px 10px;
  border-bottom: 1px solid var(--border);
}
.ind-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ind-tab-btn .tab-badge {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: var(--panel-2);
  color: var(--text-dim);
}
.ind-tab-btn.active {
  border-color: rgba(181, 138, 60, 0.55);
  background: var(--cyan-soft);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(181, 138, 60, 0.2);
}
.ind-tab-btn.active .tab-badge {
  background: var(--cyan);
  color: #0b0f17;
}
.handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border);
  margin: 10px auto 6px;
}
#picker-search {
  margin: 6px 14px 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  user-select: text; -webkit-user-select: text;
}
#picker-search:focus { border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan-glow); }
#picker-list, #ind-list { overflow-y: auto; padding: 4px 14px 24px; }

.broker-group-title, .ind-group {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  margin: 16px 0 8px;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.broker-group-title::after, .ind-group::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(255,179,0,.45), transparent);
}
.symbol-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.symbol-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all .15s;
}
.symbol-btn:active { transform: scale(.97); }
.symbol-btn.active {
  border-color: var(--cyan); color: var(--cyan);
  background: var(--cyan-soft);
  box-shadow: 0 0 10px rgba(181, 138, 60,.18);
}
.broker-loading, .broker-error { font-size: 12px; color: var(--text-dim); padding: 4px 0 10px; }
.broker-error { color: var(--down); }

/* ---- filas de indicadores con interruptor ---- */
.ind-row {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 8px;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.ind-name { font-size: 14px; font-weight: 700; display: flex; flex-direction: column; gap: 2px; }
.ind-name small { font-size: 11px; font-weight: 500; color: var(--text-dim); }
.ind-row .switch {
  position: relative; flex-shrink: 0;
  width: 42px; height: 24px; border-radius: 12px;
  background: #2b3244;
  transition: background .2s;
}
.ind-row .switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #8b93a8;
  transition: transform .2s, background .2s;
}
.ind-row.active { border-color: rgba(181, 138, 60,.55); background: linear-gradient(90deg, rgba(181, 138, 60,.08), var(--panel)); }
.ind-row.active .switch { background: linear-gradient(90deg, var(--cyan), #00b8d4); box-shadow: 0 0 10px var(--cyan-glow); }
.ind-row.active .switch::after { transform: translateX(18px); background: #fff; }

@media (min-width: 700px) {
  #picker-sheet, #ind-sheet, #account-sheet { left: 50%; right: auto; width: 520px; transform: translate(-50%, 100%); }
  #picker-overlay.show #picker-sheet, #ind-overlay.show #ind-sheet, #account-overlay.show #account-sheet { transform: translate(-50%, 0); }
}

/* ---- overlay & sheet de cuenta ---- */
#account-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
#account-overlay.show { opacity: 1; pointer-events: auto; }
#account-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 85vh;
  background: #10151f;
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(181, 138, 60,.12);
  display: flex;
  flex-direction: column;
  z-index: 51;
  padding-bottom: var(--safe-bottom);
  transform: translateY(100%);
  transition: transform 0.22s ease;
}
#account-overlay.show #account-sheet { transform: translateY(0); }
#account-scroll {
  overflow-y: auto;
  padding: 4px 14px 28px;
}

/* Tarjeta VIP */
.account-vip-card {
  background: linear-gradient(135deg, rgba(16, 26, 42, 0.95) 0%, rgba(20, 32, 54, 0.9) 100%);
  border: 1px solid rgba(181, 138, 60, 0.35);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(181, 138, 60, 0.1);
  position: relative;
  overflow: hidden;
}
.account-vip-card::after {
  content: "";
  position: absolute; top: -30px; right: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,179,0,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.vip-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.vip-avatar img {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(181, 138, 60, 0.5);
  box-shadow: 0 0 10px var(--cyan-glow);
}
.vip-info { flex: 1; min-width: 0; }
.vip-title {
  font-family: Rajdhani, Inter, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.8px;
  color: #fff;
}
.vip-user-id {
  font-size: 11px;
  color: var(--text-dim);
}
.accent-cyan {
  color: var(--cyan);
  font-weight: 700;
}
.vip-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(138, 100, 32, 0.4);
}
.vip-status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
  animation: pulse-dot 1.5s infinite ease-in-out;
}

/* Vencimiento */
.vip-card-body {
  background: rgba(11, 15, 23, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}
.expire-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.expire-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.expire-label svg {
  width: 14px; height: 14px;
  stroke: var(--cyan); fill: none; stroke-width: 2;
}
.expire-date {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
}
.expire-progress-track {
  width: 100%; height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.expire-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  border-radius: 3px;
}
.expire-subtext {
  font-size: 10px;
  color: var(--text-dim);
}

/* Menu Items */
.account-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.account-item:active {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(181, 138, 60, 0.4);
}
.account-item .item-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.account-item .item-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.account-item .item-icon.gold { background: var(--gold-soft); color: var(--gold); }
.account-item .item-icon.cyan { background: var(--cyan-soft); color: var(--cyan); }
.account-item .item-icon.purple { background: rgba(179, 136, 255, 0.15); color: #B388FF; }
.account-item .item-icon.blue { background: rgba(33, 150, 243, 0.15); color: #42A5F5; }
.account-item .item-icon.gray { background: rgba(255, 255, 255, 0.08); color: #cbd5e1; }

.account-item .item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-item .item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}
.account-item .item-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}
.item-pill.gold { background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(138, 100, 32, 0.3); }
.item-pill.online { background: rgba(3, 156, 85, 0.15); color: #4caf50; border: 1px solid rgba(3, 156, 85, 0.3); }
.item-chev {
  width: 16px; height: 16px;
  stroke: var(--text-dim); fill: none; stroke-width: 2;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.account-item.expanded .item-chev {
  transform: rotate(180deg);
}

/* Sub-paneles expandibles */
.plans-panel, .invite-panel, .lang-selector-panel, .config-panel {
  background: rgba(11, 15, 23, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-top: -2px;
  margin-bottom: 4px;
}
.plan-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.plan-name { font-size: 13px; font-weight: 800; color: var(--gold); }
.plan-badge-curr {
  font-size: 9px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(3, 156, 85, 0.2); color: #4caf50;
  border: 1px solid rgba(3, 156, 85, 0.4);
}
.plan-features {
  list-style: none; padding: 0; margin: 4px 0 8px;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11.5px; color: #cbd5e1;
}
.plan-action-btn {
  background: linear-gradient(90deg, var(--cyan), #00b8d4);
  color: #0b0f17; font-weight: 800; font-size: 12px;
  border: 0; border-radius: 10px; padding: 9px;
  cursor: pointer; transition: transform 0.15s;
}
.plan-action-btn:active { transform: scale(0.98); }

.invite-box { display: flex; flex-direction: column; gap: 8px; }
.invite-label { font-size: 11px; font-weight: 600; color: var(--text-dim); }
.invite-input-row {
  display: flex; gap: 6px;
}
.invite-input-row input {
  flex: 1; background: var(--panel); border: 1px solid var(--border);
  color: #e2e8f0; font-size: 11px; border-radius: 8px;
  padding: 8px 10px; outline: none;
}
.copy-btn {
  background: var(--cyan); color: #0b0f17;
  font-weight: 800; font-size: 11.5px;
  border: 0; border-radius: 8px; padding: 0 14px;
  cursor: pointer;
}
.copy-btn:active { transform: scale(0.96); }
.invite-share-row .share-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(33, 150, 243, 0.15); border: 1px solid rgba(33, 150, 243, 0.35);
  color: #42A5F5; border-radius: 8px; padding: 8px;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.invite-share-row .share-btn svg { width: 14px; height: 14px; fill: currentColor; }

.lang-selector-panel { display: flex; flex-direction: column; gap: 4px; }
.lang-opt {
  display: flex; align-items: center; justify-content: space-between;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--text); padding: 8px 12px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.lang-opt.active {
  background: var(--cyan-soft); border-color: rgba(181, 138, 60, 0.4);
  color: var(--cyan);
}
.lang-opt .check-icon { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 3; display: none; }
.lang-opt.active .check-icon { display: block; }

.config-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.cfg-label { display: flex; flex-direction: column; gap: 1px; }
.cfg-label span { font-size: 12.5px; font-weight: 700; color: #fff; }
.cfg-label small { font-size: 10.5px; color: var(--text-dim); }
.config-toggle-row .switch {
  position: relative; flex-shrink: 0;
  width: 42px; height: 24px; border-radius: 12px;
  background: #2b3244; border: 0; cursor: pointer;
  transition: background .2s;
}
.config-toggle-row .switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #8b93a8;
  transition: transform .2s, background .2s;
}
.config-toggle-row .switch.active { background: linear-gradient(90deg, var(--cyan), #00b8d4); box-shadow: 0 0 10px var(--cyan-glow); }
.config-toggle-row .switch.active::after { transform: translateX(18px); background: #fff; }

.config-action-row { margin-top: 8px; }
.cfg-danger-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(246, 70, 93, 0.12); border: 1px solid rgba(246, 70, 93, 0.35);
  color: #f6465d; border-radius: 8px; padding: 8px;
  font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.cfg-danger-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* WhatsApp & Share row */
.invite-share-row {
  display: flex;
  gap: 8px;
}
.invite-share-row .share-btn {
  flex: 1;
}
.invite-share-row .share-btn.wa {
  background: rgba(37, 211, 102, 0.15);
  border-color: rgba(37, 211, 102, 0.4);
  color: #25D366;
}
.invite-share-row .share-btn.wa:active {
  background: rgba(37, 211, 102, 0.25);
}

/* Theme Switcher in Config */
.theme-switch-group {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}
.theme-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-btn.active {
  background: var(--panel);
  color: var(--cyan);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.theme-btn svg {
  width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2;
}

/* Colors Panel (Chart & Tools customization) */
.colors-panel {
  background: rgba(11, 15, 23, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-top: -2px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.colors-section-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cyan);
  margin-top: 8px;
  margin-bottom: 2px;
}
.colors-section-title:first-child {
  margin-top: 0;
}
body.light-theme .colors-section-title {
  color: #0284c7;
}
.color-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.color-picker-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  cursor: pointer;
}
body.light-theme .color-picker-row label {
  color: #0f172a;
}
.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}
.color-picker-row input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  padding: 0;
}
.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-picker-row input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}
body.light-theme .color-picker-row input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.reset-colors-btn {
  margin-top: 6px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.reset-colors-btn:hover {
  color: var(--text);
  border-color: var(--cyan);
}
.reset-colors-btn svg {
  width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2;
}

/* ==========================================================================
   LIGHT THEME OVERRIDES
   ========================================================================== */
body.light-theme {
  --bg: #F2EFEA;
  --panel: #FBF9F5;
  --panel-2: #EFE9DE;
  --panel-3: #E3DCCD;
  --border: rgba(0, 0, 0, 0.1);
  --border-bright: rgba(181, 138, 60, 0.4);
  --text: #1B1813;
  --text-dim: #70685A;
  --gold-soft: rgba(138, 100, 32, 0.12);
  --cyan-soft: rgba(181, 138, 60, 0.12);
}
body.light-theme .top-bar,
body.light-theme .asset-tabs,
body.light-theme .timeframes,
body.light-theme .bottom-nav,
body.light-theme .bottom-sheet,
body.light-theme .sheet-content {
  background: #FBF9F5;
}
body.light-theme .brand-title {
  color: #1B1813;
}
body.light-theme .account-item {
  background: #FBF9F5;
  border-color: #E3DCCD;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
body.light-theme .account-item .item-title,
body.light-theme .cfg-label span,
body.light-theme .color-picker-label span,
body.light-theme .plan-features,
body.light-theme .indicator-label,
body.light-theme .sheet-title {
  color: #1B1813;
}
body.light-theme .plans-panel,
body.light-theme .invite-panel,
body.light-theme .lang-selector-panel,
body.light-theme .config-panel,
body.light-theme .colors-panel {
  background: #f8fafc;
  border-color: #E3DCCD;
}
body.light-theme .color-picker-row {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
body.light-theme .theme-switch-group {
  background: #E3DCCD;
  border-color: #D8CFBE;
}
body.light-theme .theme-btn.active {
  background: #FBF9F5;
  color: #B58A3C;
}
body.light-theme .btn-mini,
body.light-theme .tf-btn,
body.light-theme .tab-btn {
  background: #EFE9DE;
  color: #4A4336;
  border-color: #E3DCCD;
}
body.light-theme .tf-btn.active,
body.light-theme .tab-btn.active {
  background: #B58A3C;
  color: #FBF9F5;
}
body.light-theme .nav-item {
  color: #70685A;
}
body.light-theme .nav-item.active {
  color: #B58A3C;
}
body.light-theme .drawing-tools {
  background: rgba(255, 255, 255, 0.92);
  border-color: #D8CFBE;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
body.light-theme .tool-btn {
  color: #4A4336;
}
body.light-theme .tool-btn.active {
  background: var(--cyan-soft);
  color: #B58A3C;
}
body.light-theme .chart-pane {
  background: #FBF9F5;
}
body.light-theme .invite-input-row input {
  background: #FBF9F5;
  border-color: #D8CFBE;
  color: #1B1813;
}
body.light-theme .indicator-row {
  border-bottom-color: rgba(0, 0, 0, 0.05);
}
body.light-theme .sheet-handle {
  background: rgba(0, 0, 0, 0.15);
}
body.light-theme .reset-colors-btn {
  background: #EFE9DE;
  border-color: #D8CFBE;
  color: #4A4336;
}


/* ==========================================================================
   TEMA CLARO v2 (2026-10-22): los paneles, la barra superior/inferior y las
   tarjetas seguian con fondos oscuros fijos y texto claro => ilegibles.
   Este bloque va al final para pisar a los estilos oscuros anteriores.
   ========================================================================== */
body.light-theme {
  --bg-deep: #E9E4DA;
  --cyan: #B58A3C;
  --cyan-glow: rgba(181, 138, 60, 0.25);
  --gold: #8A6420;
  --up: #059669;
  --down: #dc2626;
}
body.light-theme header#topbar {
  background: #FBF9F5;
  border-image: linear-gradient(90deg, #B58A3C, transparent 45%, #8A6420) 1;
}
body.light-theme header#topbar h1 { color: #1B1813; }
body.light-theme .icon-btn { background: #EFE9DE; color: #4A4336; border-color: #D8CFBE; }
body.light-theme #symbol-bar { background: #FBF9F5; }
body.light-theme #symbol-picker-btn { background: #FBF9F5; color: #1B1813; border-color: #D8CFBE; }
body.light-theme #symbol-picker-btn .broker-tag { color: #8A6420; border-color: rgba(180, 83, 9, .5); background: rgba(138, 100, 32, .1); }
body.light-theme #price-text.up { color: #059669; text-shadow: none; }
body.light-theme #price-text.down { color: #dc2626; text-shadow: none; }
body.light-theme .timer-pill { background: #EFE9DE; color: #4A4336; border-color: #D8CFBE; }
body.light-theme #tf-row { background: #FBF9F5; border-bottom-color: #E3DCCD; }
body.light-theme .tf-pill { color: #4A4336; }
body.light-theme .tf-pill.active { background: rgba(181, 138, 60, .12); border-color: rgba(181, 138, 60, .55); color: #8A6420; box-shadow: none; }
body.light-theme #bottom-nav {
  background: #FBF9F5;
  border-image: linear-gradient(90deg, #8A6420, transparent 50%, #B58A3C) 1;
}
body.light-theme .nav-btn { color: #70685A; }
body.light-theme .nav-btn.active, body.light-theme .nav-btn:active { color: #B58A3C; }
body.light-theme .draw-tools {
  background: rgba(255, 255, 255, .95); border-color: #D8CFBE; box-shadow: 0 4px 14px rgba(27, 24, 19, .15);
}
body.light-theme .draw-tools button, body.light-theme .draw-tools .tool-btn { color: #4A4336; }
body.light-theme .draw-tools .tool-btn.active { background: rgba(181, 138, 60, .12); color: #8A6420; border-color: rgba(181, 138, 60, .5); }
body.light-theme #picker-sheet, body.light-theme #ind-sheet, body.light-theme #account-sheet {
  background: #f8fafc; border-top-color: rgba(181, 138, 60, .4); box-shadow: 0 -10px 40px rgba(27, 24, 19, .2);
  color: #1B1813;
}
body.light-theme .sheet-title { color: #8A6420; }
body.light-theme #picker-search { background: #FBF9F5; color: #1B1813; border-color: #D8CFBE; }
body.light-theme .broker-group-title { color: #8A6420; }
body.light-theme .symbol-btn { background: #FBF9F5; color: #1B1813; border-color: #D8CFBE; }
body.light-theme .symbol-btn.active { background: rgba(181, 138, 60, .12); color: #8A6420; border-color: #B58A3C; }
body.light-theme .account-vip-card {
  background: linear-gradient(135deg, #F2EFEA 0%, #fffbeb 100%);
  border-color: rgba(181, 138, 60, .35); box-shadow: 0 4px 16px rgba(27, 24, 19, .08);
}
body.light-theme .vip-title { color: #1B1813; }
body.light-theme .vip-user-id, body.light-theme .expire-subtext, body.light-theme .expire-label { color: #4A4336; }
body.light-theme .accent-cyan { color: #8A6420; }
body.light-theme .vip-status-badge { color: #8A6420; background: rgba(138, 100, 32, .12); border-color: rgba(138, 100, 32, .45); }
body.light-theme .expire-date { color: #8A6420; }
body.light-theme .vip-card-body { background: rgba(255, 255, 255, .7); border-color: #E3DCCD; }
body.light-theme .expire-progress-track { background: #E3DCCD; }
body.light-theme .account-item .item-subtitle { color: #70685A; }
body.light-theme .item-pill { background: #EFE9DE; color: #4A4336; border-color: #D8CFBE; }
body.light-theme .item-pill.gold { background: rgba(138, 100, 32, .12); color: #8A6420; border-color: rgba(138, 100, 32, .45); }
body.light-theme .item-chev { color: #70685A; }
body.light-theme .plan-card { background: #FBF9F5; border-color: #D8CFBE; color: #1B1813; }
body.light-theme .plan-action-btn { background: #B58A3C; color: #fff; }
body.light-theme .copy-btn, body.light-theme .share-btn { color: #1B1813; border-color: #D8CFBE; background: #EFE9DE; }
body.light-theme .indicator-row, body.light-theme .ind-row { background: #FBF9F5; border-color: #E3DCCD; color: #1B1813; }
body.light-theme .indicator-row.active, body.light-theme .ind-row.active { background: rgba(181, 138, 60, .08); border-color: rgba(181, 138, 60, .45); }
body.light-theme .indicator-label, body.light-theme .indicator-name { color: #1B1813; }
body.light-theme .indicator-desc, body.light-theme .indicator-sub { color: #70685A; }
body.light-theme .ind-group-title, body.light-theme .group-title { color: #8A6420; }
body.light-theme .pane-chip, body.light-theme .pane-selector { background: rgba(181, 138, 60, .08); color: #1B1813; border-color: rgba(181, 138, 60, .35); }
body.light-theme #hs-extra { background: #FBF9F5; border-color: #D8CFBE; color: #1B1813; }
body.light-theme #hs-extra .chip { background: rgba(181, 138, 60, .12); color: #8A6420; }
body.light-theme #hs-extra button { background: #EFE9DE; color: #1B1813; border-color: #D8CFBE; }
body.light-theme .account-item .item-icon.gray { background: #E3DCCD; color: #4A4336; }
body.light-theme .tab-label { color: #1B1813; }
body.light-theme .tab-btn.active .tab-label { color: #1B1813; }

/* ===================== SEÑALES + ACTIVOS (hojas inferiores) ===================== */
#sn-overlay, #sa-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.62); backdrop-filter: blur(2px);
  display: none; z-index: 50;
}
#sn-overlay.show, #sa-overlay.show { display: block; }
#sn-sheet, #sa-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; height: 84vh; max-height: 84vh;
  background: linear-gradient(180deg, #171c28 0%, #0f131c 100%);
  border-top: 1px solid rgba(181, 138, 60,.45); border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(181, 138, 60,.12);
  display: flex; flex-direction: column; z-index: 51; padding-bottom: var(--safe-bottom);
  transform: translateY(100%); transition: transform 0.22s ease;
}
#sn-overlay.show #sn-sheet, #sa-overlay.show #sa-sheet { transform: translateY(0); }
@media (min-width: 700px) {
  #sn-sheet, #sa-sheet { left: 50%; right: auto; width: 520px; transform: translate(-50%, 100%); }
  #sn-overlay.show #sn-sheet, #sa-overlay.show #sa-sheet { transform: translate(-50%, 0); }
}
#sn-body, #sa-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 14px 18px; }
.sn-tabs { display: flex; gap: 6px; margin: 4px 0 10px; }
.sn-tabs button { flex: 1; background: var(--panel, #131a26); color: var(--text-dim, #70685A); border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: 8px; font-weight: 700; font-size: 13px; }
.sn-tabs button.on { color: #1B1813; background: var(--cyan, #B58A3C); border-color: transparent; }
.sn-card { background: var(--panel, #131a26); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; margin-bottom: 12px; overflow: hidden; }
.sn-card.nuevo { border-color: rgba(181, 138, 60,.55); }
.sn-card.hl { box-shadow: 0 0 0 2px var(--gold, #ffb800); }
.sn-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px 4px; gap: 8px; }
.sn-head b { font-size: 15px; }
.sn-head span { font-size: 12px; color: var(--text-dim, #70685A); white-space: nowrap; }
.sn-tit { padding: 0 12px 6px; font-size: 13px; font-weight: 700; color: var(--gold, #ffb800); }
.sn-img { display: block; width: 100%; background: #0b0f17; cursor: zoom-in; aspect-ratio: 7 / 4; object-fit: cover; }
.sn-lines { padding: 8px 12px 0; font-size: 13px; line-height: 1.5; color: var(--text, #EFE9DE); }
.sn-act { display: flex; gap: 8px; padding: 10px 12px 12px; }
.sn-btn { flex: 1; background: var(--cyan, #B58A3C); color: #1B1813; border: 0; border-radius: 10px; padding: 10px; font-weight: 800; font-size: 13px; }
.sn-btn.g { background: transparent; color: var(--text, #EFE9DE); border: 1px solid rgba(255,255,255,.18); }
.sn-vacio { text-align: center; color: var(--text-dim, #70685A); padding: 34px 12px; font-size: 14px; line-height: 1.5; }
.sn-vacio b { display: block; color: var(--text, #EFE9DE); font-size: 16px; margin-bottom: 6px; }
.sn-aviso { background: rgba(255,184,0,.08); border: 1px solid rgba(255,184,0,.35); border-radius: 12px; padding: 10px 12px;
  font-size: 13px; line-height: 1.45; margin-bottom: 12px; }
.sn-aviso .sn-btn { margin-top: 8px; width: 100%; }
.sa-top { display: flex; justify-content: space-between; align-items: center; margin: 2px 0 10px; font-size: 13px; color: var(--text-dim, #70685A); }
.sa-top b { color: var(--cyan, #B58A3C); font-size: 15px; }
.sa-row { display: flex; justify-content: space-between; align-items: center; background: var(--panel, #131a26);
  border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 11px 12px; margin-bottom: 12px; gap: 10px; }
.sa-row small { display: block; color: var(--text-dim, #70685A); font-size: 11.5px; margin-top: 2px; }
.sa-grp { font: 700 12px Rajdhani, Inter, sans-serif; letter-spacing: 1px; text-transform: uppercase; color: var(--gold, #ffb800); margin: 14px 0 6px; }
.sa-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sa-chip { background: var(--panel, #131a26); color: var(--text, #EFE9DE); border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; }
.sa-chip.on { background: rgba(181, 138, 60,.14); border-color: var(--cyan, #B58A3C); color: var(--cyan, #B58A3C); font-weight: 700; }
.sa-sw { width: 44px; height: 26px; border-radius: 13px; background: #D8CFBE; border: 0; position: relative; flex-shrink: 0; }
.sa-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s; }
.sa-sw.on { background: var(--cyan, #B58A3C); }
.sa-sw.on::after { transform: translateX(18px); }
#sn-viewer { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.94); display: none; flex-direction: column;
  align-items: center; justify-content: center; padding: 14px; gap: 12px; }
#sn-viewer.show { display: flex; }
#sn-viewer-img { max-width: 100%; max-height: 78vh; border-radius: 10px; }
#sn-viewer-x { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 14px; width: 40px; height: 40px; font-size: 28px;
  line-height: 1; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 50%; }
#sn-viewer-go { background: var(--cyan, #B58A3C); color: #1B1813; border: 0; border-radius: 10px; padding: 11px 22px; font-weight: 800; font-size: 14px; }
.sn-toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom, 0px)); transform: translateX(-50%); z-index: 80;
  background: #EFE9DE; color: #EFE9DE; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; padding: 10px 16px; font-size: 13px; max-width: 86vw; }

body.light-theme #sn-sheet, body.light-theme #sa-sheet { background: #F2EFEA; border-top-color: #B58A3C; }
body.light-theme .sn-card, body.light-theme .sa-row, body.light-theme .sa-chip, body.light-theme .sn-tabs button { background: #fff; color: #1B1813; border-color: #E3DCCD; }
body.light-theme .sn-tabs button.on { background: #B58A3C; color: #fff; }
body.light-theme .sa-chip.on { background: #F3EAD7; border-color: #B58A3C; color: #8A6420; }
body.light-theme .sn-lines, body.light-theme .sn-vacio b, body.light-theme .sn-btn.g { color: #1B1813; }
body.light-theme .sn-btn { background: #B58A3C; color: #fff; }
body.light-theme .sn-tit, body.light-theme .sa-grp { color: #a16207; }
body.light-theme .sa-sw { background: #D8CFBE; }
body.light-theme .sa-sw.on { background: #B58A3C; }

/* ===================== temporalidades en desplegable (junto al boton de mensajes) ===================== */
#tf-row { display: none !important; }
#symbol-bar .left { flex: 1 1 auto; }
#symbol-picker-btn { flex: 0 1 auto; min-width: 0; max-width: none; }
#tf-drop-btn {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  background: var(--panel); border: 1px solid var(--border); color: var(--gold);
  border-radius: 12px; padding: 7px 8px 7px 10px; font-size: 14px; font-weight: 800;
}
#tf-drop-btn .chev { width: 13px; height: 13px; color: var(--cyan); transition: transform .15s; }
#tf-drop-btn.open { border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan-glow); }
#tf-drop-btn.open .chev { transform: rotate(180deg); }
#tf-menu {
  position: fixed; z-index: 60; display: none; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: linear-gradient(180deg, #171c28 0%, #0f131c 100%); border: 1px solid rgba(181, 138, 60,.45);
  border-radius: 14px; padding: 8px; box-shadow: 0 12px 34px rgba(0,0,0,.6); width: min(92vw, 300px);
}
#tf-menu.show { display: grid; }
#tf-menu .tf-pill { padding: 11px 0; font-size: 16px; border: 1px solid rgba(255,255,255,.08); flex: none; }
#tf-menu .tf-pill.active { border-color: var(--cyan); color: var(--cyan); background: rgba(181, 138, 60,.1); }
/* con 2 graficos: indica a cual pertenece el precio */
.price-box[data-split="1"] #price-text::before {
  content: attr(data-pane); display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 5px;
  border-radius: 4px; background: var(--cyan); color: #0b0f17; font-size: 10px; font-weight: 800; vertical-align: 1px;
}
body.light-theme #tf-drop-btn { background: #fff; border-color: #D8CFBE; color: #a16207; }
body.light-theme #tf-menu { background: #fff; border-color: #B58A3C; }
body.light-theme #tf-menu .tf-pill { color: #4A4336; border-color: #E3DCCD; }
body.light-theme #tf-menu .tf-pill.active { color: #8A6420; background: #F3EAD7; border-color: #B58A3C; }

@media (max-width: 430px) {
  #symbol-bar { padding: 8px 10px; }
  #symbol-bar .left { gap: 6px; }
  #symbol-picker-btn { gap: 6px; padding: 7px 8px 7px 6px; font-size: 13.5px; }
  #symbol-picker-btn .chev { display: none; }
  #symbol-picker-btn .broker-tag { font-size: 9.5px; padding: 2px 4px; }
  #hs-msg { width: 36px; height: 36px; }
  #tf-drop-btn { padding: 7px 6px 7px 8px; font-size: 13.5px; }
}

/* resultados dentro de Señales + tarjeta de Stop Loss */
.sn-card.sl { border-color: rgba(246,70,93,.55); }
.sn-card.sl .sn-tit { color: #f6465d; }
.sn-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 10px; }
.sn-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 6px; }
.sn-kpis > div { background: var(--panel, #131a26); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 12px; text-align: center; }
.sn-kpis b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.sn-kpis b.pos { color: var(--up, #039c55); } .sn-kpis b.neg { color: var(--down, #f6465d); }
.sn-kpis span { font-size: 12px; color: var(--text-dim, #70685A); }
.sn-bar { margin-bottom: 9px; }
.sn-bar-t { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.sn-bar-t span:last-child { color: var(--text-dim, #70685A); }
.sn-bar-b { height: 7px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.sn-bar-b i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan, #B58A3C), var(--gold, #ffb800)); border-radius: 4px; }
body.light-theme .sn-kpis > div { background: #fff; border-color: #E3DCCD; color: #1B1813; }
body.light-theme .sn-bar-b { background: #E3DCCD; }
body.light-theme .sn-bar-t { color: #1B1813; }

/* ===================== SOCIAL TRADING (salas por broker) ===================== */
#so-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.62); backdrop-filter: blur(2px); display: none; z-index: 50; }
#so-overlay.show { display: block; }
#so-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; height: 90vh; max-height: 90vh;
  background: linear-gradient(180deg, #171c28 0%, #0f131c 100%);
  border-top: 1px solid rgba(181, 138, 60,.45); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(181, 138, 60,.12);
  display: flex; flex-direction: column; z-index: 51; padding-bottom: var(--safe-bottom);
  transform: translateY(100%); transition: transform 0.22s ease;
}
#so-overlay.show #so-sheet { transform: translateY(0); }
@media (min-width: 700px) {
  #so-sheet { left: 50%; right: auto; width: 520px; transform: translate(-50%, 100%); }
  #so-overlay.show #so-sheet { transform: translate(-50%, 0); }
}
#so-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 14px 12px; display: flex; flex-direction: column; }
.so-room { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: var(--panel, #131a26); color: inherit;
  border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.so-room > div { flex: 1; min-width: 0; }
.so-room b { font-size: 16px; display: block; }
.so-room small { color: var(--text-dim, #70685A); display: block; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-n { background: var(--gold, #ffb800); color: #111; border-radius: 10px; min-width: 22px; padding: 2px 7px; font-style: normal; font-weight: 800; font-size: 12px; text-align: center; }
.so-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 0 4px; }
.so-back { flex: 0 0 auto; padding: 8px 12px; }
.so-bellinfo { font-size: 12px; color: var(--text-dim, #70685A); margin: 0 0 8px; }
.so-msgs { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 8px; }
.so-m { align-self: flex-start; max-width: 86%; background: var(--panel, #131a26); border: 1px solid rgba(255,255,255,.08); border-radius: 14px 14px 14px 4px; padding: 8px 11px; }
.so-m.mio { align-self: flex-end; background: rgba(181, 138, 60,.10); border-color: rgba(181, 138, 60,.35); border-radius: 14px 14px 4px 14px; }
.so-m.adm { border-color: rgba(255,184,0,.6); }
.so-a { font-size: 12px; font-weight: 700; color: var(--cyan, #B58A3C); display: flex; justify-content: space-between; gap: 12px; }
.so-a em { color: var(--gold, #ffb800); font-style: normal; font-size: 10.5px; border: 1px solid rgba(255,184,0,.5); border-radius: 6px; padding: 0 4px; margin-left: 4px; }
.so-a span { color: var(--text-dim, #70685A); font-weight: 400; }
.so-t { font-size: 14px; line-height: 1.4; margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.so-img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 6px; cursor: zoom-in; }
.so-x { text-align: right; margin-top: 2px; }
.so-x button, .so-x span { background: none; border: 0; color: var(--text-dim, #70685A); font-size: 11px; padding: 4px 2px; }
.so-x button:active { color: #f87171; }
.so-keep { text-align: center; font-size: 11px; opacity: .55; margin-top: 6px; }
.so-chip { align-items: center; gap: 8px; font-size: 12px; background: rgba(181, 138, 60,.1); border: 1px solid rgba(181, 138, 60,.35); border-radius: 10px; padding: 5px 10px; margin-bottom: 6px; align-self: flex-start; }
.so-chip button { background: none; border: 0; color: inherit; font-size: 18px; line-height: 1; }
.so-comp { display: flex; align-items: flex-end; gap: 8px; padding-top: 4px; }
.so-comp textarea { flex: 1; min-height: 42px; max-height: 120px; resize: none; background: var(--panel, #131a26); color: inherit; border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 10px 12px; font-size: 15px; font-family: inherit; }
.so-ic { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); background: var(--panel, #131a26); font-size: 18px; flex-shrink: 0; }
.so-send { background: var(--cyan, #B58A3C); color: #1B1813; border: 0; border-radius: 14px; padding: 0 16px; height: 42px; font-weight: 800; flex-shrink: 0; }
.so-comp button:disabled, .so-comp textarea:disabled { opacity: .5; }
body.light-theme #so-sheet { background: #F2EFEA; border-top-color: #B58A3C; }
body.light-theme .so-room, body.light-theme .so-m, body.light-theme .so-comp textarea, body.light-theme .so-ic { background: #fff; color: #1B1813; border-color: #E3DCCD; }
body.light-theme .so-m.mio { background: #F3EAD7; border-color: #B58A3C; }
body.light-theme .so-a { color: #8A6420; }
body.light-theme .so-send { background: #B58A3C; color: #fff; }
@media (max-width: 380px) { .nav-btn { font-size: 9.5px; } }

/* boton para minimizar las ventanas de abajo (flecha hacia abajo) */
.sheet-close {
  position: absolute; top: 8px; right: 10px; width: 38px; height: 38px; z-index: 5;
  display: flex; align-items: center; justify-content: center; padding: 0;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.14); border-radius: 50%;
  color: #E3DCCD; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sheet-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sheet-close:active { background: rgba(181, 138, 60,.22); }
body.light-theme .sheet-close { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.14); color: #4A4336; }

/* herramientas de dibujo: caben en un grafico bajo (modo dividido) con desplazamiento */
.draw-tools { max-height: calc(100% - 16px); }
.draw-tools-items { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.draw-tools-items::-webkit-scrollbar { display: none; }
.tool-btn { flex-shrink: 0; width: 42px; height: 42px; }
.toggle-tools-btn { width: 42px; }
.tool-btn.sel-del { color: var(--down); }

/* ---- Mi Trading (diario, riesgo, alertas, estadisticas) ---- */
#mt-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.62); backdrop-filter: blur(2px); display: none; z-index: 50; }
#mt-overlay.show { display: block; }
#mt-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; height: 90vh; max-height: 90vh;
  background: linear-gradient(180deg, #171c28 0%, #0f131c 100%);
  border-top: 1px solid rgba(181, 138, 60,.45); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(181, 138, 60,.12);
  display: flex; flex-direction: column; z-index: 51; padding-bottom: var(--safe-bottom);
  transform: translateY(100%); transition: transform 0.22s ease;
}
#mt-overlay.show #mt-sheet { transform: translateY(0); }
@media (min-width: 700px) {
  #mt-sheet { left: 50%; right: auto; width: 520px; transform: translate(-50%, 100%); }
  #mt-overlay.show #mt-sheet { transform: translate(-50%, 0); }
}
#mt-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 14px 24px; }
.mt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
#mt-body label { display: block; font-size: 12px; color: var(--text-dim, #70685A); }
#mt-body input, #mt-body select, #mt-body textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 10px; font: 500 15px Inter, system-ui, sans-serif;
  background: #0b0f17; color: #EFE9DE; border: 1px solid rgba(255,255,255,.14); border-radius: 10px;
}
#mt-body textarea { resize: vertical; }
.mt-wide { margin: 8px 0; }
.mt-lbl { font-size: 12px; color: var(--text-dim, #70685A); margin: 6px 0 2px; }
.mt-help { font-size: 11.5px; color: var(--text-dim, #70685A); margin: 4px 0 10px; line-height: 1.4; }
.mt-form { margin-bottom: 12px; }
.mt-op .sn-tit.pos { color: var(--up, #039c55); } .mt-op .sn-tit.neg { color: var(--down, #f6465d); }
.mt-hint { text-align: center; font-size: 12.5px; color: var(--cyan, #B58A3C); min-height: 18px; margin: 8px 0 2px; }
.mt-heat-row { margin: 10px 0 14px; }
.mt-heat-n b { font-size: 14px; } .mt-heat-n small { display: block; color: var(--text-dim, #70685A); font-size: 11.5px; margin-bottom: 5px; }
.mt-heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.mt-heat i { display: block; height: 26px; border-radius: 3px; }
.mt-heat-x { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-dim, #70685A); margin-top: 2px; }
.mt-prev { position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mt-prev-box { background: #131a26; border: 1px solid rgba(181, 138, 60,.4); border-radius: 16px; padding: 14px; max-width: 420px; width: 100%; max-height: 92vh; overflow: auto; text-align: center; }
.mt-prev-box img { width: 100%; border-radius: 10px; margin: 10px 0; }
body.light-theme #mt-sheet { background: #F2EFEA; }
body.light-theme #mt-body input, body.light-theme #mt-body select, body.light-theme #mt-body textarea { background: #fff; color: #1B1813; border-color: #D8CFBE; }

/* Social: reacciones con emoji (estilo WhatsApp) */
.so-rx { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.so-re { background: rgba(255,255,255,.06); color: inherit; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 3px 10px; font: 600 13px Inter, system-ui, sans-serif; line-height: 1.4; }
.so-re.on { background: rgba(181, 138, 60,.16); border-color: rgba(181, 138, 60,.6); }
.so-re.add { opacity: .7; padding: 3px 9px; }
.so-pick { display: flex; gap: 6px; margin-top: 6px; padding: 6px 8px; background: #0b0f17; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; width: max-content; max-width: 100%; }
.so-pick button { background: transparent; border: 0; font-size: 22px; line-height: 1; padding: 4px 6px; border-radius: 10px; }
.so-pick button:active { background: rgba(255,255,255,.12); transform: scale(1.15); }
body.light-theme .so-re { background: #E9E4DA; border-color: #D8CFBE; color: #1B1813; }
body.light-theme .so-re.on { background: #F3EAD7; border-color: #B58A3C; }
body.light-theme .so-pick { background: #fff; border-color: #D8CFBE; }

/* Operacion: calculadora de ganancia/perdida sobre el grafico */
.pos-panel { position: absolute; left: 50%; transform: translateX(-50%); bottom: 36px; z-index: 6; width: min(96%, 470px);
  background: rgba(16,21,31,.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(181, 138, 60,.4); border-radius: 14px; box-shadow: 0 6px 22px rgba(0,0,0,.5); padding: 7px 9px; touch-action: manipulation; }
.pos-sum { display: flex; align-items: center; gap: 7px; flex-wrap: nowrap; }
.pos-dir { display: flex; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; overflow: hidden; flex-shrink: 0; }
.pos-dir button { background: transparent; border: 0; color: var(--text-dim, #70685A); font: 700 12px Inter, system-ui, sans-serif; padding: 5px 9px; }
.pos-dir button.on { background: var(--cyan, #B58A3C); color: #1B1813; }
.pos-g { color: #2ee6a6; font: 800 14px Inter, system-ui, sans-serif; } .pos-p { color: #ff6a5c; font: 800 14px Inter, system-ui, sans-serif; }
.pos-rr { color: var(--text-dim, #70685A); font: 600 12px Inter, system-ui, sans-serif; flex: 1; text-align: right; white-space: nowrap; }
.pos-tg, .pos-x { background: transparent; border: 0; color: var(--text-dim, #70685A); font-size: 16px; padding: 4px 5px; flex-shrink: 0; }
.pos-body { display: none; margin-top: 6px; }
.pos-panel.abierto .pos-body { display: block; }
.pos-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pos-grid label { display: block; font: 600 10px Inter, system-ui, sans-serif; color: var(--text-dim, #70685A); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-grid input { display: block; width: 100%; margin-top: 2px; padding: 6px 5px; font: 600 13px Inter, system-ui, sans-serif; background: #0b0f17; color: #EFE9DE; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; }
.pos-pie { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.pos-info { flex: 1; font: 500 10.5px/1.35 Inter, system-ui, sans-serif; color: var(--text-dim, #70685A); }
.pos-rec { flex-shrink: 0; padding: 7px 10px; background: rgba(181, 138, 60,.12); color: var(--cyan, #B58A3C); border: 1px solid rgba(181, 138, 60,.45); border-radius: 9px; font: 700 12px Inter, system-ui, sans-serif; white-space: nowrap; }
body.light-theme .pos-panel { background: rgba(255,255,255,.96); border-color: #B58A3C; }
body.light-theme .pos-grid input { background: #fff; color: #1B1813; border-color: #D8CFBE; }

.pos-modo { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font: 600 11px Inter, system-ui, sans-serif; color: var(--text-dim, #70685A); }
.pos-seg { display: flex; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; overflow: hidden; }
.pos-seg button { background: transparent; border: 0; color: var(--text-dim, #70685A); font: 700 12px Inter, system-ui, sans-serif; padding: 5px 12px; }
.pos-seg button.on { background: var(--gold, #FFB800); color: #1a1200; }
.pos-grid input.calc { background: rgba(255,255,255,.05); color: var(--gold, #FFB800); border-style: dashed; }

/* con 2 graficos, el que tiene una operacion se agranda y el otro se oculta mientras dure */
#charts-container.maxi-1 #pane-2, #charts-container.maxi-2 #pane-1 { display: none !important; }
.pos-mx { background: transparent; border: 0; color: var(--text-dim, #70685A); font-size: 16px; padding: 4px 5px; flex-shrink: 0; }
/* resumen de la operacion: compacto para que quepa en una sola linea con los 3 botones */
.pos-sum { gap: 5px; }
.pos-g, .pos-p { font-size: 13px; white-space: nowrap; }
.pos-rr { font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pos-dir button { padding: 5px 7px; font-size: 11px; }
.pos-tg, .pos-x, .pos-mx { padding: 4px 3px; }

/* pestaña "Tendencia" de Señales (explosivos a favor de tendencia) */
.sn-tabs button { padding-left: 4px; padding-right: 4px; white-space: nowrap; }
.sn-tr { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel, #131a26); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.sn-tr small { display: block; color: var(--text-dim, #70685A); font-size: 12px; margin-top: 2px; }
.sn-tr .sn-btn { width: auto; flex-shrink: 0; padding: 7px 11px; white-space: nowrap; font-size: 12.5px; }
.sn-trh { font-weight: 800; margin: 12px 2px 6px; }
.sn-trh.spike { color: #2ee6a6; } .sn-trh.drop { color: #ff6a5c; }
