/* ── Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: var(--tg-theme-bg-color, #0d0d1a);
  --bg2: var(--tg-theme-secondary-bg-color, #13131f);
  --fg: var(--tg-theme-text-color, #e8e8f0);
  --fg2: var(--tg-theme-hint-color, #888899);
  --accent: var(--tg-theme-button-color, #4f8cff);
  --accent-fg: var(--tg-theme-button-text-color, #ffffff);
  --danger: #ff4f4f;
  --success: #4fcf70;
  --warning: #f0b429;
  --border: rgba(255,255,255,0.08);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p  { color: var(--fg2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 24px;
  border: none; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--fg2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.8rem; color: var(--fg2); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .field textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 0.95rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
  font-family: var(--font);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--fg2); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 0.72rem; font-weight: 600; }
.badge-open    { background: rgba(79,140,255,.15); color: #4f8cff; }
.badge-tp1     { background: rgba(79,207,112,.15); color: #4fcf70; }
.badge-tp2     { background: rgba(79,207,112,.25); color: #4fcf70; }
.badge-tp3     { background: rgba(79,207,112,.4);  color: #4fcf70; }
.badge-sl      { background: rgba(255,79,79,.15);  color: #ff4f4f; }
.badge-cancelled { background: rgba(136,136,153,.15); color: #888899; }

.pnl-pos { color: var(--success); font-weight: 700; }
.pnl-neg { color: var(--danger);  font-weight: 700; }
.pnl-pending { color: var(--fg2); font-style: italic; font-weight: 400; }

.tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.04); border-radius: var(--radius-sm); padding: 4px; }
.tab-btn { flex: 1; padding: 8px 4px; border: none; border-radius: 6px; background: transparent; color: var(--fg2); font-size: 0.76rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-btn.active { background: var(--bg2); color: var(--fg); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

.nav { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.nav-back { background: none; border: none; color: var(--accent); font-size: 1.2rem; cursor: pointer; padding: 4px; }
.nav-title { font-weight: 700; font-size: 1rem; flex: 1; }

#toast-container { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none; min-width: 240px; max-width: 90vw; }
.toast { background: #222233; color: var(--fg); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.88rem; box-shadow: var(--shadow); animation: toast-in .2s ease; border-left: 3px solid var(--accent); }
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; align-items: center; justify-content: center; min-height: 200px; }

.tools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px; }
.tool-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; transition: border-color .15s, transform .1s; text-align: center; }
.tool-card:hover { border-color: var(--accent); }
.tool-card:active { transform: scale(0.97); }
.tool-card .tool-icon { font-size: 2.2rem; }
.tool-card .tool-label { font-weight: 700; font-size: 0.95rem; }
.tool-card .tool-desc { font-size: 0.75rem; color: var(--fg2); }

.search-wrap { position: relative; }
.search-wrap input { width: 100%; padding-left: 36px; }
.search-wrap .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg2); font-size: 1rem; pointer-events: none; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); z-index: 20; max-height: 220px; overflow-y: auto; }
.search-result-item { padding: 10px 14px; cursor: pointer; font-size: 0.9rem; transition: background .1s; }
.search-result-item:hover { background: rgba(255,255,255,.06); }
.search-result-item .pair-ws { font-weight: 700; }
.search-result-item .pair-alt { font-size: 0.75rem; color: var(--fg2); }

.pred-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pred-card-header { display: flex; align-items: center; gap: 8px; }
.pred-card-pair { font-weight: 700; font-size: 1rem; }
.pred-card-side { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.pred-card-side.long  { background: rgba(79,207,112,.2); color: var(--success); }
.pred-card-side.short { background: rgba(255,79,79,.2);  color: var(--danger); }
.pred-levels { display: flex; gap: 8px; flex-wrap: wrap; }
.pred-level { font-size: 0.75rem; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.05); }
.pred-level.hit { text-decoration: line-through; opacity: .6; }
.pred-level.tp  { color: var(--success); }
.pred-level.sl  { color: var(--danger); }
.pred-pnl { font-size: 1.2rem; }
.pred-price { font-size: 0.8rem; color: var(--fg2); }

#chart-container { width: 100%; height: 280px; background: var(--bg2); border-radius: var(--radius); overflow: hidden; position: relative; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th { text-align: left; padding: 8px 10px; color: var(--fg2); font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.p-16 { padding: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.text-muted { color: var(--fg2); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-accent { color: var(--accent); }
.w-full { width: 100%; }
.hidden { display: none !important; }

.pred-card-clickable { cursor: pointer; transition: border-color .15s, transform .1s; }
.pred-card-clickable:hover  { border-color: var(--accent); }
.pred-card-clickable:active { transform: scale(0.98); }
.pred-card-arrow { text-align: right; color: var(--fg2); font-size: 1.1rem; line-height: 1; margin-top: 2px; }

.pred-hero { padding: 20px 16px 16px; text-align: center; background: var(--bg2); border-bottom: 1px solid var(--border); }
.pred-hero-price { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.pred-hero-pnl   { font-size: 1.5rem; font-weight: 700; margin-top: 4px; }
.pred-hero-sub   { font-size: 0.8rem; color: var(--fg2); margin-top: 6px; }

.dv-chart-container { width: 100%; height: 260px; background: var(--bg2); border-radius: var(--radius); overflow: hidden; position: relative; }

.levels-grid { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.level-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--bg2); transition: opacity .2s; }
.level-row.level-entry { background: rgba(79,140,255,.08); }
.level-row.is-hit { opacity: 0.5; }
.level-icon  { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }
.level-name  { font-weight: 700; font-size: 0.82rem; width: 40px; flex-shrink: 0; }
.level-price { font-size: 0.9rem; flex: 1; font-variant-numeric: tabular-nums; }
.level-dist  { font-size: 0.78rem; font-weight: 600; flex-shrink: 0; }

.pred-events-list { display: flex; flex-direction: column; gap: 6px; }
.pred-event-item  { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }

.pred-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; color: var(--fg2); margin-bottom: -2px; }
.pred-author    { font-weight: 600; }
.pred-date      { font-variant-numeric: tabular-nums; }
.scope-btn.active { border-color: var(--accent); color: var(--accent); }

/* ── Predicciones completadas ─────────────────────────────────────────── */
.pred-card-tp   { border-color: rgba(79,207,112,.4); background: linear-gradient(180deg, rgba(79,207,112,.06) 0%, var(--bg2) 100%); }
.pred-card-sl   { border-color: rgba(255,79,79,.4);  background: linear-gradient(180deg, rgba(255,79,79,.06)  0%, var(--bg2) 100%); }
.pred-card-cancelled { opacity: 0.6; }

.pred-card-done-banner {
  margin: -14px -14px 4px;
  padding: 6px 14px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: .04em;
  border-radius: var(--radius) var(--radius) 0 0;
}
.banner-tp { background: rgba(79,207,112,.18); color: var(--success); }
.banner-sl { background: rgba(255,79,79,.18);  color: var(--danger); }

.pred-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.label-opt { font-size: 0.7rem; color: var(--fg2); font-weight: 400; }

/* ── Comentarios ──────────────────────────────────────────────────────── */
.comment-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-size: 0.65rem; font-weight: 800;
  border-radius: 99px; padding: 1px 5px; margin-left: 2px;
}

.comments-panel {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .3s ease;
}
.comments-panel.visible { transform: translateY(0); }

.comments-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 0.95rem; flex-shrink: 0;
}
.btn-close-comments { background: none; border: none; color: var(--fg2); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; }

.comments-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }

.comment-item { padding: 10px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.comment-unread { border-color: var(--accent); background: rgba(79,140,255,.07); }
.comment-meta   { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--fg2); margin-bottom: 4px; }
.comment-author { font-weight: 700; color: var(--fg); }
.comment-time   { margin-left: auto; }
.comment-body   { font-size: 0.87rem; line-height: 1.4; }
.cmt-actions    { display: flex; gap: 2px; margin-left: 4px; }
.btn-cmt-edit, .btn-cmt-del { background: none; border: none; cursor: pointer; font-size: .8rem; padding: 1px 3px; opacity: .5; line-height: 1; }
.btn-cmt-edit:hover, .btn-cmt-del:hover { opacity: 1; }

/* ── WS status indicator ──────────────────────────────────────── */
.ws-dot {
  position: fixed; bottom: 10px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  z-index: 9999; pointer-events: none;
  transition: background .4s, box-shadow .4s;
}
.ws-dot-on  { background: var(--success); box-shadow: 0 0 6px rgba(79,207,112,.7); }
.ws-dot-off { background: var(--warning); box-shadow: 0 0 6px rgba(240,180,41,.5);
  animation: ws-blink 1.2s ease-in-out infinite; }
@keyframes ws-blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.comments-form {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.comments-form input { flex: 1; }

/* ── Portal de predicciones ───────────────────────────────────────────── */
.portal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.portal-title { font-size: 1.1rem; font-weight: 800; }
.portal-subtitle { font-size: .75rem; color: var(--fg2); margin-top: 2px; }

.portal-stats-row {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.portal-stat {
  flex: 1; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 6px; text-align: center;
  transition: transform .1s;
}
.portal-stat-n { font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.portal-stat-l { font-size: 0.6rem; color: var(--fg2); margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; }
.portal-stat-blue  { border-color: rgba(79,140,255,.3); }
.portal-stat-green { border-color: rgba(79,207,112,.3); }
.portal-stat-red   { border-color: rgba(255,79,79,.3); }
.portal-stat-gold  { border-color: rgba(240,180,41,.3); }

.pred-portal-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.pred-tile {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
  text-align: center;
}
.pred-tile:hover  { border-color: rgba(255,255,255,.18); }
.pred-tile:active { background: rgba(255,255,255,.06); transform: scale(0.97); }
.tile-ico  { font-size: 2.2rem; line-height: 1; }
.tile-ttl  { font-size: .95rem; font-weight: 700; }
.tile-sub  { font-size: .72rem; color: var(--fg2); }

.pred-tile-open { border-color: rgba(79,140,255,.28); }
.pred-tile-open:hover { border-color: var(--accent); background: rgba(79,140,255,.05); }
.pred-tile-open .tile-ttl { color: var(--accent); }

.pred-tile-history { border-color: rgba(240,180,41,.25); }
.pred-tile-history:hover { border-color: rgba(240,180,41,.6); background: rgba(240,180,41,.04); }
.pred-tile-history .tile-ttl { color: var(--warning); }

.pred-tile-dash { border-color: rgba(168,85,247,.25); }
.pred-tile-dash:hover { border-color: rgba(168,85,247,.6); background: rgba(168,85,247,.04); }
.pred-tile-dash .tile-ttl { color: #a855f7; }

.pred-tile-new { border-color: rgba(79,207,112,.35); background: rgba(79,207,112,.05); }
.pred-tile-new:hover { border-color: var(--success); background: rgba(79,207,112,.1); }
.pred-tile-new .tile-ttl { color: var(--success); }
.pred-tile-disabled { opacity: .45; cursor: default; }

/* ── Dashboard ────────────────────────────────────────────────────────── */
.dash-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;
}
.dash-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 12px; text-align: center;
}
.dash-card-n   { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.dash-card-l   { font-size: .7rem; color: var(--fg2); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }
.dash-card-win { border-color: rgba(79,207,112,.3); }
.dash-card-win .dash-card-n { color: var(--success); }
.dash-card-loss { border-color: rgba(255,79,79,.3); }
.dash-card-loss .dash-card-n { color: var(--danger); }

.dash-pair-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.dash-pair-row:last-child { border-bottom: none; }
.dash-pair-name { font-size: .8rem; font-weight: 700; min-width: 70px; }
.dash-pair-ops  { font-size: .7rem; color: var(--fg2); min-width: 38px; }
.dash-pair-rate { font-size: .78rem; font-weight: 700; min-width: 38px; text-align: right; }

/* ── Filtros de historial ─────────────────────────────────────────────── */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 12px;
  font-size: .78rem; color: var(--fg2); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip.active {
  background: rgba(79,140,255,.18); border-color: var(--accent);
  color: var(--accent); font-weight: 700;
}

/* ── Selector de timeframe (gráficas) ─────────────────────────────────── */
.tf-btns {
  display: flex; gap: 4px;
  background: rgba(255,255,255,.04); border-radius: var(--radius-sm);
  padding: 3px;
}
.tf-btn {
  flex: 1; padding: 5px 4px;
  border: none; border-radius: 6px;
  background: transparent; color: var(--fg2);
  font-size: .75rem; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.tf-btn:hover  { color: var(--fg); }
.tf-btn.active {
  background: var(--bg2); color: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* ── Admin: summary tiles ─────────────────────────────────────────────── */
.admin-summary-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px;
}
.admin-sum-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.admin-sum-ico { font-size: 1.5rem; }
.admin-sum-n   { font-size: 1.1rem; font-weight: 800; line-height: 1.1; }
.admin-sum-l   { font-size: .68rem; color: var(--fg2); text-transform: uppercase; letter-spacing: .05em; }

/* ── Admin: section grid (cards de entrada a cada sección) ───────────── */
.admin-section-card { position: relative; }
.admin-section-badge {
  position: absolute; top: 8px; right: 8px;
  background: linear-gradient(135deg, #ff4f4f 0%, #ff7a4f 100%);
  color: #fff; font-size: .7rem; font-weight: 800;
  padding: 2px 8px; border-radius: 10px; min-width: 22px;
  text-align: center; line-height: 1.4;
  box-shadow: 0 2px 8px rgba(255,79,79,.4);
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ── Admin: cards ─────────────────────────────────────────────────────── */
.admin-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.admin-cards-tight { display: flex; flex-direction: column; gap: 8px; }

/* User card */
.admin-user-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.admin-user-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.admin-user-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg,#4f8cff,#a855f7);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; color: #fff; flex-shrink: 0;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-user-meta { font-size: .72rem; color: var(--fg2); margin-top: 2px; }
.admin-user-meta-2 { font-size: .68rem; color: var(--fg2); margin-top: 1px; }
.admin-section-label {
  font-size: .68rem; color: var(--fg2); text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 6px; padding-top: 6px; border-top: 1px solid var(--border);
}
.admin-tools-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.admin-tool-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.02); transition: background .15s;
}
.admin-tool-row.is-checked { background: rgba(79,140,255,.06); }
.admin-tool-label { flex: 1; font-size: .82rem; }
.admin-perm-select {
  font-size: .72rem; background: rgba(255,255,255,.06);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--fg); padding: 3px 6px; cursor: pointer;
}
.admin-perm-select:disabled { opacity: .4; cursor: not-allowed; }
.admin-bell-toggle {
  display: inline-flex; align-items: center; gap: 3px; cursor: pointer;
  padding: 3px 6px; border-radius: 6px; transition: background .15s;
}
.admin-bell-toggle:hover { background: rgba(255,255,255,.05); }
.admin-bell-toggle input { cursor: pointer; }
.admin-bell-toggle span { font-size: .9rem; }

.admin-user-foot { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.admin-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.admin-toggle.small { font-size: .82rem; }
.admin-toggle span { color: var(--fg2); }
.admin-toggle input:checked + span { color: var(--fg); font-weight: 600; }

.admin-pill {
  display: inline-flex; align-items: center;
  font-size: .62rem; font-weight: 700; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 99px;
}
.admin-pill-admin { background: rgba(168,85,247,.18); color: #c9a9f7; }
.admin-pill-active { background: rgba(79,207,112,.18); color: var(--success); }
.admin-pill-inactive { background: rgba(255,79,79,.15); color: var(--danger); }

/* Tool card */
.admin-tool-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.admin-tool-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.admin-tool-emoji { font-size: 2rem; line-height: 1; }
.admin-tool-name { font-weight: 700; font-size: 1rem; }
.admin-tool-slug { font-size: .68rem; color: var(--fg2); margin-top: 2px; }
.admin-tool-slug code { background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; }
.admin-tool-desc { font-size: .82rem; color: var(--fg2); margin: 6px 0 10px; }
.admin-tool-foot { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.admin-order-field { display: inline-flex; align-items: center; gap: 6px; }
.admin-order-lbl { font-size: .78rem; color: var(--fg2); }
.admin-order-field input {
  width: 56px; background: rgba(255,255,255,.06);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 6px; color: var(--fg); font-size: .82rem;
}

/* Prediction card (admin) */
.admin-pred-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.admin-pred-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.admin-pred-pair { font-weight: 800; font-size: .9rem; }
.admin-pred-data { display: flex; flex-wrap: wrap; gap: 10px; font-size: .75rem; padding: 6px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 6px 0; }
.admin-pred-foot { display: flex; justify-content: space-between; font-size: .68rem; color: var(--fg2); }

/* Audit timeline */
.admin-timeline { display: flex; flex-direction: column; gap: 0; }
.audit-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.audit-row:last-child { border-bottom: none; }
.audit-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(79,140,255,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.audit-body { flex: 1; min-width: 0; }
.audit-action code { background: rgba(255,255,255,.06); padding: 1px 6px; border-radius: 4px; font-size: .78rem; color: var(--accent); }
.audit-meta { display: flex; flex-wrap: wrap; gap: 4px; font-size: .7rem; color: var(--fg2); margin-top: 4px; }
.audit-detail { font-size: .68rem; color: var(--fg2); margin-top: 4px; padding: 4px 6px; background: rgba(0,0,0,.2); border-radius: 4px; word-break: break-all; }

/* ── Admin: modal de sesiones y filas de sesión ───────────────────────── */
.admin-modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(5, 13, 26, .8);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.admin-modal {
  background: var(--bg2, #1a1a2e);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: var(--radius, 12px);
  max-width: 480px; width: 100%; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.admin-modal-head, .admin-modal-foot {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border, #2a2a4a);
  font-weight: 700; font-size: .95rem;
}
.admin-modal-foot {
  border-top: 1px solid var(--border, #2a2a4a);
  border-bottom: none; justify-content: flex-end;
}
.admin-modal-body { overflow-y: auto; padding: 8px 10px; flex: 1; }
.session-row {
  padding: 10px 12px; border-bottom: 1px solid var(--border, #2a2a4a);
  font-size: .82rem;
}
.session-row:last-child { border-bottom: none; }
.session-row.is-active { background: rgba(79,207,112,.05); border-radius: 6px; }
.session-row-head { display: flex; align-items: center; gap: 6px; }
.session-device { font-weight: 700; flex: 1; }
.session-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.session-dot.on  { background: #4fcf70; box-shadow: 0 0 6px #4fcf70; }
.session-dot.off { background: #555; }
.session-row-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: .72rem; color: var(--fg2); margin-top: 4px;
}

/* ── Market data: exchange logos + stats ───────────────────────────────── */
.pred-exchanges {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.pred-exchanges:empty { display: none; }
.pred-exch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.06); overflow: hidden;
  text-decoration: none; transition: transform .12s, box-shadow .15s;
  flex-shrink: 0;
}
.pred-exch:hover { transform: scale(1.18); box-shadow: 0 2px 8px rgba(79,140,255,.35); }
.pred-exch img { width: 100%; height: 100%; object-fit: cover; }
.pred-exch-fallback {
  font-size: .58rem; font-weight: 800;
  color: var(--fg2); letter-spacing: -.03em;
}

/* Bloque de stats de mercado en la vista de detalle */
.pred-market {
  margin: 12px 16px 0;
  padding: 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pred-market-loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 80px;
}
.pred-market-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border); border-radius: var(--radius-sm);
  overflow: hidden;
}
.pred-stat {
  background: var(--bg2);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.pred-stat-l {
  font-size: .65rem; color: var(--fg2);
  text-transform: uppercase; letter-spacing: .03em;
  line-height: 1.2;
}
.pred-stat-v {
  font-size: .92rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.pred-stat-up   { font-size: .72rem; font-weight: 700; color: var(--success); }
.pred-stat-down { font-size: .72rem; font-weight: 700; color: var(--danger); }

.pred-market-web {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 8px 12px;
  background: rgba(79,140,255,.08); border: 1px solid rgba(79,140,255,.2);
  border-radius: var(--radius-sm); color: var(--accent);
  font-size: .82rem; font-weight: 600; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.pred-market-web:hover {
  background: rgba(79,140,255,.14);
  border-color: var(--accent);
}

.pred-market-exch-title {
  font-size: .65rem; color: var(--fg2);
  text-transform: uppercase; letter-spacing: .05em;
  margin-top: 14px; margin-bottom: 6px;
}
.pred-market .pred-exchanges {
  margin: 0; padding: 0; border-top: none;
}
.pred-market .pred-exch {
  width: 28px; height: 28px;
}

/* Piloto Automático — toggle switch */
.toggle-wrap { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.toggle-wrap input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255,255,255,.12); border-radius: 22px; transition: background .2s; }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: transform .2s; }
.toggle-wrap input:checked + .toggle-slider { background: var(--accent); }
.toggle-wrap input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Reacciones ──────────────────────────────────────────────────────────── */

.reactions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
  align-items: center;
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 999px;
  background: transparent;
  color: var(--fg, #e8e8ec);
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  user-select: none;
}

.reaction-chip:hover {
  background: rgba(255,255,255,0.05);
}

.reaction-chip:active {
  transform: scale(0.96);
}

.reaction-chip.reaction-mine {
  background: rgba(99, 132, 255, 0.16);
  border-color: rgba(99, 132, 255, 0.55);
  color: #d8e1ff;
}

.reaction-chip .cnt {
  font-size: 11px;
  opacity: 0.85;
  min-width: 1ch;
}

.reaction-chip[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Variante compacta dentro de un comentario */
.comment-item .reactions-bar {
  margin: 6px 0 0;
}
.comment-item .reaction-chip {
  padding: 2px 6px;
  font-size: 12px;
}

/* ── Bloque de interacciones por pred-card ──────────────────────────────── */

.pred-interactions {
  margin-top: 12px;
}

.pred-interactions-divider {
  height: 1px;
  background: var(--border, rgba(255,255,255,0.08));
  margin: 0 0 12px;
}

.pred-interactions-reactions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pred-interactions-label {
  font-size: 12px;
  color: var(--fg2, #9aa0a6);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Anular el margin original de .reactions-bar cuando vive dentro del bloque */
.pred-interactions-reactions .reactions-bar {
  margin: 0;
}

.pred-interactions-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
