/* Candel Mind — estilos */
:root {
  --bg: #090a0d;
  --panel: #101218;
  --card: #13161e;
  --line: #232732;
  --txt: #ece9e2;
  --muted: #9aa0ab;
  --gold: #f0d18a;
  --gold-deep: #d9a24c;
  --up: #2fd27e;
  --down: #ef5d5d;
  --blue: #4aa3ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}

/* ---------- DEVICE (contenedor tipo teléfono) ---------- */
/* En móvil real ocupa el 100% del viewport, sin marco. */
/* En escritorio (>=769px) lo transformamos en un mockup de celular. */
.device {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  transform: translateZ(0); /* crea containing block: los position:fixed quedan dentro del marco */
}
.device-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.device-screen::-webkit-scrollbar { display: none; }
#app { height: 100%; min-height: 100%; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- HOME (fondo cuero con relieve + focos de techo) ---------- */
.home-wrap {
  position: relative;
  height: 100%; min-height: 0; overflow-y: auto;
  overscroll-behavior: contain; scrollbar-width: none;
  display: flex; flex-direction: column;
  width: 100%;
  padding: calc(env(safe-area-inset-top) + 46px) 18px 120px;
  background-color: #050608;
  /* fondo vertical: ocupa toda la pantalla, hasta abajo */
  background-image: url("../assets/home-bg.jpg");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}
.home-wrap::-webkit-scrollbar { display: none; }
.home-head { position: relative; z-index: 2; text-align: center; margin: 0 0 22px; width: 100%; }
.home-logo { width: 100%; }
.home-logo img { width: 46%; max-width: 178px; height: auto; display: block; margin: 0 auto; filter: drop-shadow(0 8px 26px rgba(255,196,104,0.14)); }
.home-title {
  margin: 12px 0 2px; font-size: 28px; letter-spacing: 1px; font-weight: 700;
  color: var(--gold); text-shadow: 0 2px 20px rgba(240,209,138,0.15);
}
.home-title span { color: var(--txt); }

/* La lista es lo único que scrollea: el logo, la barra y el fondo quedan fijos. */
.home-list {
  position: relative; z-index: 2; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.home-list::-webkit-scrollbar { display: none; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; display: flex; align-items: center; justify-content: space-between;
  transition: transform .1s, border-color .2s;
}
.card:active { transform: scale(0.985); }
.card-main { display: flex; align-items: center; gap: 14px; }
.card-ico { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; background: #1a1e28; border-radius: 12px; }
.card-name { font-size: 17px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-menu { background: none; border: none; color: var(--muted); font-size: 22px; padding: 6px 10px; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

.new-btn {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px);
  transform: translateX(-50%);
  width: calc(100% - 40px); max-width: 320px;
  background: var(--gold); color: #1a1205; border: none;
  border-radius: 14px; padding: 14px 16px; font-size: 16px; font-weight: 700;
  box-shadow: 0 10px 26px rgba(240,209,138,0.35);
  z-index: 16;
}
.new-btn:active { transform: translateX(-50%) scale(0.98); }

/* ---------- CHART ---------- */
.chart-wrap { min-height: 100%; position: relative; padding-bottom: 90px; }
.chart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 12px 10px;
  position: sticky; top: 0; z-index: 5; background: rgba(9,10,13,0.86); backdrop-filter: blur(8px);
}
.icon-btn { background: var(--card); border: 1px solid var(--line); color: var(--txt); width: 42px; height: 42px; border-radius: 12px; font-size: 24px; }
.chart-title { font-size: 20px; font-weight: 700; color: var(--gold); }

/* toolbar de temporalidades */
.chart-tf { display: flex; gap: 6px; justify-content: center; padding: 8px 12px 2px; }
.chart-tf .tf {
  flex: 1; max-width: 64px; background: var(--card); border: 1px solid var(--line);
  color: var(--muted); border-radius: 12px; padding: 7px 0; font-size: 13px; font-weight: 600;
  transition: color .15s, border-color .15s, background .15s;
}
.chart-tf .tf.active { color: #1a1205; background: var(--gold); border-color: var(--gold); font-weight: 700; }

/* escenario del gráfico: barra de tendencia al costado + viewport de canvas */
.chart-stage { position: relative; }
.chart-view { position: relative; margin-left: 20px; height: 340px; }
#chart-canvas, #crosshair-canvas { position: absolute; top: 0; left: 0; display: block; touch-action: none; }
#crosshair-canvas { z-index: 2; cursor: crosshair; }

/* indicador lateral dorado de tendencia alcista */
.trend-bar {
  position: absolute; left: 0; top: 2px; bottom: 2px; width: 14px;
  border-radius: 8px; overflow: hidden;
  background: rgba(240,209,138,0.10);
  box-shadow: inset 0 0 0 1px rgba(240,209,138,0.22);
}
.trend-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 50%;
  border-radius: 8px;
  background: linear-gradient(180deg, #f6d98a, #d9a24c);
  box-shadow: 0 0 14px rgba(233,185,95,0.65);
  transition: height .5s ease;
}

/* leyenda como botones de color */
.chart-legend { display: flex; gap: 12px; justify-content: center; padding: 10px 12px 0; }
.chart-legend .lg {
  background: none; border: 1px solid transparent; border-radius: 12px;
  padding: 7px 12px; font-size: 12px; font-weight: 600; line-height: 1;
  transition: background .15s, border-color .15s;
}
.chart-legend .lg:hover { background: rgba(255,255,255,0.06); }
.lg.up { color: var(--up); } .lg.down { color: var(--down); } .lg.ev { color: var(--blue); }

.fab {
  position: fixed; right: 22px; bottom: calc(env(safe-area-inset-bottom) + 26px);
  width: 64px; height: 64px; border-radius: 50%; border: none;
  background: var(--gold); color: #1a1205; font-size: 32px; font-weight: 700;
  box-shadow: 0 10px 30px rgba(240,209,138,0.35); z-index: 20;
}
.fab:active { transform: scale(0.94); }

/* ---------- MODAL ---------- */
.modal-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.overlay {
  position: absolute; inset: 0; background: rgba(4,5,7,0.7);
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: auto;
}
.sheet {
  position: relative;
  background: #fff; color: #15171c; width: 100%; max-width: 560px;
  border-radius: 24px 24px 0 0; padding: 22px 22px calc(env(safe-area-inset-bottom) + 28px);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  animation: slide .22s ease; max-height: 92%; overflow-y: auto;
}
.sheet-x {
  position: absolute; top: 12px; right: 14px; background: #eef0f4; border: 1px solid #e2e4ea;
  color: #555; width: 34px; height: 34px; border-radius: 50%; font-size: 16px; line-height: 1;
}
@keyframes slide { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { margin: 0; font-size: 20px; }
.sheet-text { color: #6b7280; font-size: 14px; margin: 0 0 16px; }
.swatch { width: 100%; height: 56px; border-radius: 14px; border: 1px solid #e2e4ea; margin-bottom: 6px; }
input[type="color"].input { height: 48px; padding: 4px; cursor: pointer; }

.row { display: flex; align-items: center; }
.gap { gap: 10px; } .wrap { flex-wrap: wrap; }
.lbl { display: block; font-size: 13px; color: #9aa0ab; margin: 14px 0 6px; }
.input {
  width: 100%; background: #f3f4f6; border: 1px solid #e2e4ea; color: #15171c;
  border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none;
}
.input:focus { border-color: var(--gold-deep); }
.ta { resize: vertical; line-height: 1.4; }

.btn { border: none; border-radius: 14px; padding: 14px 18px; font-size: 16px; font-weight: 600; flex: 1; }
.btn.primary { background: var(--gold-deep); color: #fff; }
.btn.ghost { background: #eef0f4; color: #333; border: 1px solid #e2e4ea; }
.btn.danger { background: #ffeeec; color: #d0392f; }
.btn.bleu { background: var(--blue); color: #fff; flex: 1; margin-top: 16px; }

.chip { background: #eef0f4; border: 1px solid #e2e4ea; border-radius: 20px; padding: 9px 14px; font-size: 14px; }

/* ---------- hold-to-load candles ---------- */
.hold-row { display: flex; gap: 18px; justify-content: center; margin: 8px 0 6px; }
.candle-btn {
  --p: 0; --c: #2fd27e;
  position: relative; width: 118px; height: 118px; border-radius: 20px;
  background: #f3f4f6; border: 1px solid #e2e4ea;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow .15s, border-color .15s;
}
.candle-btn.up { --c: #2fd27e; }
.candle-btn.down { --c: #ef5d5d; }
.candle-btn.charging { border-color: var(--c); box-shadow: 0 0 42px 4px var(--c); }
.candle-btn .cb-body {
  position: absolute; bottom: 38px; left: 50%; transform: translateX(-50%);
  width: 36px; height: calc(22px + 58px * var(--p)); border-radius: 7px; background: var(--c);
}
.candle-btn .cb-wick {
  position: absolute; bottom: calc(38px + 22px + 58px * var(--p)); left: 50%; transform: translateX(-50%);
  width: 4px; height: 18px; border-radius: 2px; background: #e9b95f;
}
.hint { text-align: center; color: #9aa0ab; font-size: 13px; margin: 8px 0 0; }

/* ---------- entry / event forms ---------- */
.entry-badge { display: inline-block; border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.entry-badge.up { background: #e7f9f0; color: #13a35f; }
.entry-badge.down { background: #ffeeec; color: #d0392f; }
.desc-wrap { position: relative; }
.mic {
  position: absolute; right: 10px; bottom: 10px; background: #fff; border: 1px solid #e2e4ea;
  border-radius: 50%; width: 40px; height: 40px; font-size: 18px;
}
.mic.on { background: #ffeeec; border-color: #d0392f; animation: pulse 1s infinite; }
.mic.off { opacity: 0.45; cursor: not-allowed; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(208,57,47,0.15); } }

.day-list { display: flex; flex-direction: column; gap: 8px; }
.day-sec { color: #9aa0ab; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin: 12px 0 6px; }
.day-item { display: flex; align-items: center; gap: 12px; background: #f3f4f6; border: 1px solid #e2e4ea; border-radius: 12px; padding: 12px 14px; }
.day-t { flex: 1; text-align: left; font-size: 15px; }
.day-meta { color: #9aa0ab; font-size: 12px; white-space: nowrap; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.dot.up { background: var(--up); } .dot.down { background: var(--down); }

/* ---------- hover / foco (azul = seleccionable) ---------- */
.new-btn, .btn, .fab, .card-menu { border: 2px solid transparent; }
.new-btn:hover, .new-btn:focus-visible,
.card:hover, .card:focus-visible,
.icon-btn:hover, .icon-btn:focus-visible,
.fab:hover, .fab:focus-visible,
.chip:hover, .chip:focus-visible,
.btn:hover, .btn:focus-visible,
.card-menu:hover, .card-menu:focus-visible,
.day-item:hover, .day-item:focus-visible {
  border-color: var(--blue);
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 100px); transform: translateX(-50%);
  background: #1c202b; color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 60; box-shadow: 0 8px 26px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- DESKTOP: Mockup de teléfono ---------- */
/* Solo en escritorio (>=769px): centramos la app dentro de un marco de celular. */
@media (min-width: 769px) {
  body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100dvh; padding: 24px;
    background:
      radial-gradient(1100px 700px at 50% 20%, rgba(240,209,138,0.05), transparent 60%),
      #04050a;
  }
  .device {
    width: 390px; height: 844px; max-height: 94dvh;
    border-radius: 44px;
    box-shadow:
      0 0 0 11px #0f1117,      /* cuerpo del dispositivo */
      0 0 0 13px #2a2d35,      /* bisel metálico */
      0 40px 90px rgba(0,0,0,0.7),
      0 4px 20px rgba(0,0,0,0.5);
  }
}

/* ---------- BARRA SUPERIOR: ☰ a la izquierda, 🔔 a la derecha ---------- */
.top-bar {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 14px; right: 14px;
  z-index: 12; display: flex; align-items: center; justify-content: space-between;
}
.menu-btn, .bell-btn {
  position: relative; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(19,22,30,0.8); color: var(--txt);
  font-size: 22px; line-height: 1; padding: 0;
}
.bell-btn { font-size: 19px; }
.menu-btn:active, .bell-btn:active { transform: scale(0.94); }
.bell-dot {
  position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 2px rgba(9,10,13,0.92); display: none;
}
.bell-dot.on { display: block; }

/* ---------- AVISOS (dentro de la campana) ---------- */
.nt-item {
  display: flex; gap: 12px; padding: 14px; margin-bottom: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
}
.nt-ico { font-size: 22px; line-height: 1.2; flex: none; }
.nt-body { flex: 1; min-width: 0; }
.nt-body b { display: block; color: var(--txt); font-size: 14.5px; margin-bottom: 5px; line-height: 1.35; }
.nt-body span { display: block; color: #9aa0ab; font-size: 13px; line-height: 1.45; }
.nt-go { margin-top: 12px; }
.nt-empty { color: #9aa0ab; font-size: 14px; text-align: center; padding: 26px 0; }

.menu-gr { margin: 12px 0; }
.menu-lab { color: #9aa0ab; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.menu-gr .btn { margin-bottom: 8px; }

/* ---------- CALCULADORAS ---------- */
.calc-result { background: #f3f4f6; border: 1px solid #e2e4ea; border-radius: 14px; padding: 12px 14px; margin: 14px 0; }
.calc-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 14px; }
.calc-row span { color: #6b7280; }
.calc-row b { color: #15171c; }

/* ---------- NOTICIAS ---------- */
.news-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.news-tab { flex: 1; padding: 8px 0; border-radius: 12px; border: 1px solid #e2e4ea; background: #f3f4f6; color: #6b7280; font-weight: 600; font-size: 13px; }
.news-tab.active { background: var(--gold-deep); color: #fff; border-color: var(--gold-deep); }
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-item { background: #f3f4f6; border: 1px solid #e2e4ea; border-radius: 12px; padding: 12px 14px; }
.news-item a { color: #15171c; text-decoration: none; font-weight: 600; font-size: 14px; }
.news-item a:hover { color: var(--gold-deep); }
.news-meta { color: #9aa0ab; font-size: 12px; margin-top: 4px; }

/* ---------- WATCHLIST ---------- */
.wl-head, .wl-row { display: flex; align-items: center; gap: 8px; }
.wl-head { color: #9aa0ab; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; padding: 8px 4px; border-bottom: 1px solid #e2e4ea; }
.wl-row { background: #f3f4f6; border: 1px solid #e2e4ea; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.wl-list { max-height: 320px; overflow-y: auto; }
.wl-col { flex: 1; display: flex; flex-direction: column; }
.wl-col b { color: #15171c; font-size: 14px; }
.wl-col span { color: #9aa0ab; font-size: 12px; }
.wl-right { align-items: flex-end; }
.wl-right b { color: #15171c; }
.wl-fav { background: none; border: none; font-size: 18px; color: var(--gold); padding: 0 4px; }
.wl-alarm { background: none; border: none; font-size: 16px; opacity: 0.55; padding: 0 4px; }

/* ---------- GRÁFICO DE INVERSIÓN ---------- */
.pnl-card { background: #f3f4f6; border: 1px solid #e2e4ea; border-radius: 14px; padding: 12px 14px; margin: 12px 0; text-align: center; }
.pnl-lbl { color: #6b7280; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.pnl-amt { font-size: 26px; font-weight: 800; margin: 6px 0 2px; }
.pnl-pct { font-size: 15px; font-weight: 700; }
.pnl-amt.pos, .pnl-pct.pos { color: #13a35f; }
.pnl-amt.neg, .pnl-pct.neg { color: #d0392f; }
#iv-canvas { width: 100%; border-radius: 12px; border: 1px solid #e2e4ea; margin-top: 6px; }

/* ---------- TradingView embebido ---------- */
.tv-wrap { height: 420px; border-radius: 12px; overflow: hidden; border: 1px solid #e2e4ea; margin-top: 10px; background: #000; }
.wl-tv { background: none; border: none; font-size: 15px; opacity: 0.6; padding: 0 4px; }

/* ---------- CHAT P2P ---------- */
.chat-contacts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.chat-contact { display: flex; align-items: center; gap: 10px; background: #f3f4f6; border: 1px solid #e2e4ea; border-radius: 12px; padding: 12px 14px; text-align: left; }
.chat-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.chat-dot.on { background: #2fd27e; box-shadow: 0 0 8px rgba(47,210,126,0.7); }
.chat-dot.off { background: #c3c8d0; }
.chat-cname { flex: 1; color: #15171c; font-weight: 600; font-size: 14px; }
.chat-csub { color: #9aa0ab; font-size: 12px; }
.chat-msgs { max-height: 320px; overflow-y: auto; background: #f3f4f6; border: 1px solid #e2e4ea; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-bubble { max-width: 80%; padding: 9px 12px; border-radius: 14px; font-size: 14px; color: #15171c; background: #fff; border: 1px solid #e2e4ea; align-self: flex-start; }
.chat-bubble.out { align-self: flex-end; background: var(--gold-deep); color: #fff; border-color: var(--gold-deep); }
.chat-time { display: block; font-size: 10px; opacity: 0.6; margin-top: 3px; }
.chat-name-row { margin-bottom: 6px; }

/* ---------- MODALES con el fondo del marco (tema oscuro) ---------- */
.sheet {
  background-color: #0b0d12;
  background-image:
    radial-gradient(130% 55% at 50% 0%, rgba(255,205,120,0.10), rgba(255,205,120,0) 70%),
    linear-gradient(180deg, rgba(6,7,10,0.40), rgba(6,7,10,0.60)),
    url("../assets/leather-tile.jpg");
  background-size: auto, cover, 460px 460px;
  background-position: center top, center top, center top;
  background-repeat: no-repeat, no-repeat, repeat;
  color: var(--txt);
  border: 1px solid rgba(240,209,138,0.16);
  box-shadow: 0 -10px 44px rgba(0,0,0,0.72);
}
.sheet-head h3 { color: var(--gold); }
.sheet-text { color: #9aa0ab; }
.sheet-x { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.14); color: #cfd4dc; }
.sheet .lbl { color: #9aa0ab; }
.sheet .input { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.14); color: var(--txt); }
.sheet .input:focus { border-color: var(--gold-deep); }
.sheet select.input option { background: #12151b; color: var(--txt); }
.sheet .btn.ghost { background: rgba(255,255,255,0.10); color: var(--txt); border: 1px solid rgba(255,255,255,0.14); }
.sheet .btn.danger { background: rgba(208,57,47,0.18); color: #ff8a7a; }
.sheet .chip { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.14); color: var(--txt); }
.sheet .calc-result { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.10); }
.sheet .calc-row span { color: #9aa0ab; }
.sheet .calc-row b { color: var(--txt); }
.sheet .day-item, .sheet .wl-row, .sheet .news-item, .sheet .chat-contact { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.10); }
.sheet .day-item:hover, .sheet .day-item:focus-visible { border-color: var(--blue); }
.sheet .day-t, .sheet .wl-col b, .sheet .chat-cname { color: var(--txt); }
.sheet .day-meta, .sheet .wl-col span, .sheet .chat-csub, .sheet .news-meta { color: #9aa0ab; }
.sheet .news-item a { color: var(--txt); }
.sheet .news-tab { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); color: #9aa0ab; }
.sheet .news-tab.active { background: var(--gold-deep); color: #fff; border-color: var(--gold-deep); }
.sheet .chat-msgs { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.10); }
.sheet .chat-bubble { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12); color: var(--txt); }
.sheet .chat-bubble.out { background: var(--gold-deep); color: #fff; border-color: var(--gold-deep); }
.sheet .pnl-card { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.10); }
.sheet .wl-head { color: #9aa0ab; border-color: rgba(255,255,255,0.10); }
.sheet .menu-lab { color: #9aa0ab; }
.sheet .hint { color: #9aa0ab; }

/* ---------- Paleta de fondo del gráfico ---------- */
.bg-preview { height: 110px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.16); margin: 10px 0 4px; }
.bg-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 8px 0 2px; }
.bg-sw { height: 46px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.16); cursor: pointer; padding: 0; }
.bg-sw.active { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Foto en las velas ---------- */
.photo-btns { display: flex; gap: 10px; }
.photo-wrap { margin-top: 10px; }
.photo-wrap img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; border: 1px solid rgba(255,255,255,0.16); display: block; }
.photo-del { margin-top: 8px; background: rgba(208,57,47,0.18); color: #ff8a7a; border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; padding: 7px 14px; font-size: 13px; }
.day-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex: none; border: 1px solid rgba(255,255,255,0.16); }

/* ---------- Pantalla de activación (licencia) ---------- */
.lic-box { position: relative; z-index: 2; max-width: 420px; width: 100%; margin: 20px auto 0; text-align: center; }
.lic-h { color: var(--gold); font-size: 22px; margin: 0 0 8px; }
.lic-txt { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 18px; }
.lic-inp { text-align: center; letter-spacing: 2px; text-transform: uppercase; font-weight: 600; }
.lic-msg { min-height: 20px; margin: 12px 0; font-size: 14px; }
.lic-msg.ok { color: #2fd27e; }
.lic-msg.err { color: #ff8a7a; }
.lic-buy { display: block; margin-top: 18px; color: var(--muted); font-size: 13px; text-decoration: none; }
.lic-buy:hover { color: var(--gold); }
.lic-hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 16px 0 0; opacity: .85; }

/* ---------- RESPALDO ---------- */
.bk-note { color: #9aa0ab; font-size: 13.5px; line-height: 1.55; margin: 0 0 14px; }
.bk-note b { color: var(--gold); }
.bk-stat {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 4px;
}
.bk-stat b { display: block; color: var(--txt); font-size: 15px; margin-bottom: 4px; }
.bk-stat span { color: #9aa0ab; font-size: 12.5px; }
.bk-chk {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px 2px; color: #9aa0ab; font-size: 13px; cursor: pointer;
}
.bk-chk input { width: 18px; height: 18px; accent-color: var(--gold-deep); cursor: pointer; }

/* ---------- VISOR DE FOTO (pantalla completa) ---------- */
.foto-view {
  position: absolute; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: rgba(3,4,6,0.97); backdrop-filter: blur(6px);
}
.foto-top {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 14px 10px;
}
.fv-hint { color: #7f8b99; font-size: 11.5px; flex: 1; }
.fv-btn {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  color: var(--txt); font-size: 20px; line-height: 1; padding: 0;
}
.fv-btn:active { transform: scale(0.94); }
.fv-btn:disabled { opacity: 0.35; }
.foto-lienzo {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none; cursor: grab;
}
.foto-lienzo img {
  max-width: 100%; max-height: 100%;
  transform-origin: center center;
  will-change: transform; user-select: none; -webkit-user-drag: none;
}
.foto-abajo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 14px calc(env(safe-area-inset-bottom) + 16px);
}
.fv-ok {
  flex: none; background: var(--gold); color: #1a1205; border: none;
  border-radius: 12px; padding: 0 20px; height: 44px; font-size: 14.5px; font-weight: 700;
}
.fv-ok:active { transform: scale(0.96); }
.photo-wrap img { cursor: pointer; }

/* ---------- MONTO DE LA VELA ($ y el número) ---------- */
.monto-wrap { display: none; align-items: center; gap: 9px; margin-top: 10px; }
.monto-wrap.visible { display: flex; }
.monto-signo {
  flex: none; width: 46px; height: 48px; display: grid; place-items: center;
  font-size: 26px; font-weight: 800; line-height: 1;
  border-radius: 13px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
}
.monto-signo.pos { color: var(--up); }
.monto-signo.neg { color: var(--down); }
.monto-inp { flex: 1; min-width: 0; font-size: 21px; font-weight: 700; letter-spacing: .5px; }
.monto-inp::-webkit-outer-spin-button, .monto-inp::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.monto-inp { -moz-appearance: textfield; appearance: textfield; }

/* ---------- MARCA $ (vela que entra en el Total) ---------- */
.tit-row { display: flex; align-items: center; gap: 9px; }
.tit-row .input { flex: 1; min-width: 0; }
.sum-btn {
  flex: none; width: 52px; height: 48px; border-radius: 14px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  color: #7f8b99; font-size: 22px; font-weight: 800; line-height: 1; padding: 0;
}
.sum-btn.on {
  background: var(--gold); border-color: var(--gold); color: #1a1205;
  box-shadow: 0 6px 20px rgba(240,209,138,0.28);
}
.sum-btn:active { transform: scale(0.95); }
.sum-hint { color: #7f8b99; font-size: 12px; line-height: 1.4; margin: 8px 0 0; }
.sum-hint.on { color: var(--gold); }

.day-sum {
  margin-left: auto; flex: none; font-weight: 800;
  font-size: 13.5px; padding-left: 8px; white-space: nowrap;
}
.day-sum.pos { color: var(--up); }
.day-sum.neg { color: var(--down); }

/* ---------- PANEL DEL TOTAL ---------- */
.tt-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tt-tab {
  flex: 1; min-width: 92px; background: rgba(255,255,255,0.06); color: var(--muted);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 12px;
  padding: 9px 6px; font-size: 12.5px; font-weight: 600; font-family: inherit;
}
.tt-tab.on { background: var(--gold); border-color: var(--gold); color: #1a1205; font-weight: 700; }
.tt-periodo { color: #7f8b99; font-size: 12px; margin: 0 0 12px; }
.tt-periodo b { color: var(--txt); }
.tt-fila {
  display: flex; align-items: center; gap: 11px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px; padding: 13px 14px; margin-bottom: 8px;
}
.tt-ico { font-size: 15px; width: 18px; text-align: center; }
.tt-lbl { flex: 1; color: var(--txt); font-size: 14.5px; }
.tt-lbl small { display: block; color: #7f8b99; font-size: 11.5px; margin-top: 2px; }
.tt-fila b { font-size: 19px; font-weight: 800; }
.tt-verde .tt-ico, .tt-verde b { color: var(--up); }
.tt-rojo .tt-ico, .tt-rojo b { color: var(--down); }
.tt-total { margin-top: 12px; border-color: rgba(240,209,138,0.30); background: rgba(240,209,138,0.08); }
.tt-total .tt-ico { color: var(--gold); }
.tt-total b { font-size: 24px; }
.tt-total.pos b { color: var(--up); }
.tt-total.neg b { color: var(--down); }
.tt-nota { color: #7f8b99; font-size: 12px; line-height: 1.5; margin: 12px 0 0; }
.tt-nota b { color: var(--gold); }
.tt-vacio { color: var(--muted); font-size: 14px; line-height: 1.6; text-align: center; padding: 20px 6px; }
.tt-vacio b { color: var(--gold); }

/* ---------- MODO DEMO ---------- */
/* En la demo no se escribe nada: sin botón de agregar ni de nuevo gráfico. */
.is-demo .fab, .is-demo .new-btn, .is-demo .card-menu { display: none !important; }

/* Botón de PnL en la demo del gráfico de inversiones */.demo-pnl { padding: 18px 14px 0; display: flex; justify-content: center; }
.btn-pnl {
  width: 100%; max-width: 300px; background: rgba(74,163,255,0.14); color: #9ecbff;
  border: 1px solid rgba(74,163,255,0.45); border-radius: 14px;
  padding: 13px 16px; font-size: 14px; font-weight: 700;
}
.btn-pnl:active { transform: scale(0.98); }

/* Panel de PnL */
.pnl-box {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 14px;
}
.pnl-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 14px; }
.pnl-row span { color: #9aa0ab; }
.pnl-row b { color: var(--txt); }
.pnl-tot { border-top: 1px solid rgba(255,255,255,0.10); margin-top: 5px; padding-top: 9px; }
.pnl-tot b { font-size: 16px; }
.pnl-canvas { display: block; width: 100%; }
.pnl-foot { color: #9aa0ab; font-size: 12.5px; line-height: 1.5; margin: 12px 0 0; }

/* Fuente de la cotización en el gráfico de inversión */
.iv-src { color: #7f8b99; font-size: 11.5px; line-height: 1.4; margin: 0 0 10px; min-height: 16px; }
.demo-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px calc(env(safe-area-inset-bottom) + 9px);
  background: rgba(8,10,14,0.96);
  border-top: 1px solid rgba(240,209,138,0.26);
  backdrop-filter: blur(8px);
}
.demo-tag {
  flex: none; background: var(--gold); color: #1a1205;
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  padding: 4px 7px; border-radius: 6px;
}
.demo-txt { flex: 1; color: #9aa0ab; font-size: 11.5px; line-height: 1.3; }.demo-buy {
  flex: none; background: var(--gold); color: #1a1205; text-decoration: none;
  font-size: 12.5px; font-weight: 700; padding: 8px 14px; border-radius: 10px;
}
.demo-buy:active { transform: scale(0.96); }
/* con un modal abierto la barra estorba: se esconde */
body.modal-open .demo-bar { display: none; }
.is-demo .home-wrap { padding-bottom: 78px; }
.is-demo .chart-wrap { padding-bottom: 130px; }
