/* ─── Login overlay ─── */
.login-overlay {
    position: fixed; inset: 0;
    background: radial-gradient(circle at 50% 30%, #11161d 0%, #06090d 100%);
    z-index: 200;
    display: flex;     /* visible por defecto hasta que body.authed esté seteado */
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-overlay.show { display: flex; }
/* Sin authed: solo se ve el login. Cuando body tiene .authed, se ve la app y se oculta el login. */
body:not(.authed) .topbar,
body:not(.authed) .view,
body:not(.authed) .modal,
body:not(.authed) .chat-widget { display: none !important; }
body.authed .login-overlay { display: none; }
body.authed .login-overlay.show { display: flex; }   /* show sobrescribe (token expiró) */
.login-card {
    width: 100%;
    max-width: 380px;
    background: #11161d;
    border: 1px solid #1f2630;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 4px;
}
.login-brand .logo {
    color: #56d364;
    font-size: 20px;
    text-shadow: 0 0 14px rgba(86, 211, 100, 0.7);
}
.login-brand .title { font-weight: 700; font-size: 16px; }
.login-sub {
    color: #8b949e;
    font-size: 13px;
    text-align: center;
    margin-bottom: 22px;
}
#login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#login-pass {
    background: #0d1218;
    color: #e6edf3;
    border: 1px solid #2a3441;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 140ms, box-shadow 140ms;
}
#login-pass:focus {
    outline: none;
    border-color: #2f7d3a;
    box-shadow: 0 0 0 3px rgba(47, 125, 58, 0.2);
}
#login-form .btn {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
}
.login-error {
    color: #f85149;
    font-size: 12px;
    text-align: center;
    margin-top: 4px;
}
.btn-logout {
    background: transparent;
    border: 1px solid #2a3441;
    color: #8b949e;
    width: 28px; height: 28px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    margin-left: 4px;
    transition: all 120ms;
}
.btn-logout:hover { color: #f85149; border-color: #5d1f24; background: #1d0a0a; }

/* ─── Reset y base ─── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* el atributo hidden tiene que ganarle a cualquier display: flex/grid que pongamos abajo */
[hidden] { display: none !important; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    background: #0b0f14;
    color: #e6edf3;
    font-size: 14px;
    min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
a { color: #56d364; text-decoration: none; }

/* ─── Topbar ─── */
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 24px;
    background: linear-gradient(180deg, #11161d, #0e131a);
    border-bottom: 1px solid #1f2630;
    position: sticky;
    top: 0;
    z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
    color: #56d364; font-size: 18px;
    text-shadow: 0 0 12px rgba(86, 211, 100, 0.6);
}
.brand .title { font-weight: 600; letter-spacing: 0.3px; }
.tabs { display: flex; gap: 4px; }
.tab {
    background: transparent;
    color: #8b949e;
    border: 0;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 500;
}
.tab:hover { background: #1a212b; color: #e6edf3; }
.tab.active { background: #1f2937; color: #56d364; }
.tab .badge {
    display: none;
    background: #f85149;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    margin-left: 6px;
}
.tab .badge.on { display: inline-block; }
.conn { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8b949e; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #f85149; }
.dot.ok { background: #56d364; box-shadow: 0 0 8px rgba(86, 211, 100, 0.6); }

/* ─── Views ─── */
.view { display: none; padding: 20px 24px; }
.view.active { display: block; }

/* ─── Stat cards ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.stat {
    background: #11161d;
    border: 1px solid #1f2630;
    border-radius: 12px;
    padding: 14px 16px;
}
.stat-label { color: #8b949e; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; color: #e6edf3; }
.stat-sub { color: #8b949e; font-size: 12px; margin-top: 2px; }
.stat-value.last-winner {
    display: inline-block; padding: 2px 14px; border-radius: 999px;
    background: #1f2937; color: #56d364;
}
.stat.day-stat {
    background: linear-gradient(135deg, #11161d, #131a23);
    border-left: 3px solid #56d364;
}
.stat.day-stat .stat-label { color: #6ee7b7; }
.stat-value.pos { color: #56d364; }
.stat-value.neg { color: #f85149; }

/* ─── Cards ─── */
.card {
    background: #11161d;
    border: 1px solid #1f2630;
    border-radius: 12px;
    padding: 16px;
}
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 600; color: #e6edf3; }

/* ─── Dashboard layout ─── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: auto auto;
    gap: 12px;
}
/* fila 1: tablero (4/6) | multiplicadores (2/6) */
.dashboard-grid > .card:nth-child(1) { grid-column: 1 / 5; grid-row: 1; }
.dashboard-grid > .card:nth-child(2) { grid-column: 5 / 7; grid-row: 1; }
/* fila 2: ganadores | apuestas | eventos (2/6 cada uno) */
.dashboard-grid > .card:nth-child(3) { grid-column: 1 / 3; grid-row: 2; }
.dashboard-grid > .card:nth-child(4) { grid-column: 3 / 5; grid-row: 2; }
.dashboard-grid > .card:nth-child(5) { grid-column: 5 / 7; grid-row: 2; }
@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-grid > .card { grid-column: 1 !important; grid-row: auto !important; }
}

/* Header del board + filtro por usuario */
.board-header { gap: 12px; flex-wrap: wrap; }
.board-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
}
.board-controls select {
    min-width: 180px;
    max-width: 260px;
    padding: 6px 10px;
    font-size: 12.5px;
}
.board-filter-info {
    background: rgba(86, 211, 100, 0.08);
    border: 1px solid rgba(86, 211, 100, 0.3);
    color: #56d364;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.board-filter-info .clear-filter {
    background: transparent;
    border: 1px solid rgba(86, 211, 100, 0.4);
    color: #56d364;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: background 120ms;
}
.board-filter-info .clear-filter:hover { background: rgba(86, 211, 100, 0.15); }

/* Bet-log card (apuestas en vivo con usuario) */
.bet-log {
    max-height: 240px;
    overflow-y: auto;
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bet-log .bl-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(13, 18, 24, 0.4);
    border-radius: 6px;
    border-left: 2px solid transparent;
    animation: bl-slide 220ms ease-out;
}
@keyframes bl-slide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.bet-log .bl-row.bl-place { border-left-color: #56d364; }
.bet-log .bl-row.bl-delete { border-left-color: #f85149; }
.bet-log .bl-time {
    color: #6b7280;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.bet-log .bl-user {
    color: #79c0ff;
    font-weight: 600;
    background: rgba(121, 192, 255, 0.1);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    cursor: pointer;
    transition: background 120ms;
    justify-self: start;
}
.bet-log .bl-user:hover { background: rgba(121, 192, 255, 0.25); }
.bet-log .bl-meta { display: flex; align-items: center; gap: 6px; }
.bet-log .bl-amt { font-weight: 800; }
.bet-log .bl-place .bl-amt { color: #56d364; }
.bet-log .bl-delete .bl-amt { color: #f85149; }
.bet-log .bl-num {
    display: inline-block;
    padding: 2px 9px;
    background: #1f2937;
    border-radius: 999px;
    font-weight: 700;
    font-size: 11px;
    min-width: 28px;
    text-align: center;
}

/* ─── Roulette board ─── */
.roulette-board {
    display: grid;
    grid-template-columns: 60px repeat(12, 1fr) 60px;
    grid-template-rows: repeat(3, 56px) auto auto;
    gap: 3px;
    background: #0d1218;
    padding: 6px;
    border-radius: 10px;
}
.cell {
    background: #1a212b;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #e6edf3;
    font-size: 13px;
    cursor: default;
    transition: background 120ms;
    overflow: hidden;
}
.cell .num { font-size: 13px; z-index: 2; }
/* Badge del MONTO apostado: esquina INFERIOR DERECHA, completamente estático.
   El badge del multiplicador vive en la esquina superior izquierda — así quedan
   en esquinas diagonalmente opuestas y nunca se solapan. */
.cell .amount {
    position: absolute;
    bottom: 3px;
    right: 4px;
    top: auto;
    left: auto;
    font-size: 10px;
    font-weight: 800;
    color: #fde047;
    z-index: 4;
    background: linear-gradient(180deg, rgba(58, 42, 4, 0.96), rgba(20, 14, 0, 0.96));
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(253, 224, 71, 0.45);
    white-space: nowrap;
    line-height: 1.15;
    letter-spacing: 0.25px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.cell .amount:empty { display: none; }
.cell.outside .amount,
.cell.column  .amount {
    top: 50%;
    bottom: auto;
    right: 10px;
    transform: translateY(-50%);
    font-size: 11px;
}
.cell.red { background: #5d1f24; }
.cell.black { background: #1a1f24; }
.cell.green { background: #0e3a1a; }
.cell.zero { grid-row: span 3; }
.cell.outside { background: #1f2937; font-size: 12px; min-height: 40px; }
.cell.column { background: #1f2937; font-size: 12px; }
.cell.winner { box-shadow: 0 0 0 2px #56d364, 0 0 18px rgba(86,211,100,0.5) inset; }
.cell { cursor: pointer; }
.cell:hover {
    outline: 1px solid rgba(86, 211, 100, 0.5);
    outline-offset: -1px;
}
.cell.multiplier::after {
    content: attr(data-mult);
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
    z-index: 3;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
/* ─── 13 tiers de multiplicador (basic → celestial + legendary) ─── */
/* Colores tomados del cliente legacy de jugadores (gray, blue, green, etc + gradients). */
/* text-shadow oscuro para legibilidad en todos los tiers. */

.mult-tag { text-shadow: 0 2px 2px rgba(0, 0, 0, 0.55); }

.mult-tag.tier-basic     { background: #6b7280;                                         color: #fff; border-color: #9ca3af; }
.mult-tag.tier-standard  { background: #2563eb;                                         color: #fff; border-color: #60a5fa; }
.mult-tag.tier-advanced  { background: #16a34a;                                         color: #fff; border-color: #4ade80; }
.mult-tag.tier-pro       { background: #f97316;                                         color: #fff; border-color: #fb923c; }
.mult-tag.tier-elite     { background: #9333ea;                                         color: #fff; border-color: #c084fc; }
.mult-tag.tier-master    { background: crimson;                                         color: #fff; border-color: #ff4d6d; }
.mult-tag.tier-ultra     { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-color: #764ba2; }
.mult-tag.tier-legendary {
    background: gold; color: #2a1d00; border-color: #ffeb70;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}
.mult-tag.tier-supreme   {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff; border-color: #f5576c;
    box-shadow: 0 0 14px rgba(245, 87, 108, 0.5);
}
.mult-tag.tier-epic      {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    color: #fff; border-color: #ff6b6b;
    box-shadow: 0 0 14px rgba(255, 107, 107, 0.55);
}
.mult-tag.tier-divine    {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff; border-color: #4facfe;
    box-shadow: 0 0 16px rgba(79, 172, 254, 0.55);
}
.mult-tag.tier-mythic    {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #fff; border-color: #fee140;
    box-shadow: 0 0 16px rgba(254, 225, 64, 0.55);
    animation: mythic-glow 2.5s ease-in-out infinite;
}
.mult-tag.tier-celestial {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
    color: #fff; border-color: #30cfd0;
    box-shadow: 0 0 20px rgba(48, 207, 208, 0.6);
    animation: celestial-pulse 2.4s ease-in-out infinite;
}
.mult-tag.tier-celestial .num,
.mult-tag.tier-mythic .num,
.mult-tag.tier-divine .num,
.mult-tag.tier-epic .num,
.mult-tag.tier-supreme .num,
.mult-tag.tier-ultra .num   { background: rgba(0, 0, 0, 0.35); }

@keyframes mythic-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(254, 225, 64, 0.35); }
    50%      { box-shadow: 0 0 22px rgba(254, 225, 64, 0.8); }
}
@keyframes celestial-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(48, 207, 208, 0.5); }
    50%      { box-shadow: 0 0 28px rgba(48, 207, 208, 0.95); }
}

/* Overlay sobre las celdas del tablero (data-mult muestra "120x" etc).
   Vive arriba a la IZQUIERDA — el badge del monto apostado vive a la derecha. */
.cell.multiplier::after {
    content: attr(data-mult);
    position: absolute;
    top: 3px;
    left: 4px;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    z-index: 4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.3px;
    line-height: 1.15;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.cell.tier-basic::after     { background: #6b7280; color: #fff; }
.cell.tier-standard::after  { background: #2563eb; color: #fff; }
.cell.tier-advanced::after  { background: #16a34a; color: #fff; }
.cell.tier-pro::after       { background: #f97316; color: #fff; }
.cell.tier-elite::after     { background: #9333ea; color: #fff; }
.cell.tier-master::after    { background: crimson; color: #fff; }
.cell.tier-ultra::after     { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; }
.cell.tier-legendary::after { background: gold; color: #2a1d00; }
.cell.tier-supreme::after   { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: #fff; }
.cell.tier-epic::after      { background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%); color: #fff; }
.cell.tier-divine::after    { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: #fff; }
.cell.tier-mythic::after    { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); color: #fff; }
.cell.tier-celestial::after { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); color: #fff; }

.cell.multiplier                { box-shadow: inset 0 0 0 2px currentColor; }
.cell.multiplier.tier-basic     { color: #9ca3af; }
.cell.multiplier.tier-standard  { color: #60a5fa; }
.cell.multiplier.tier-advanced  { color: #4ade80; }
.cell.multiplier.tier-pro       { color: #fb923c; }
.cell.multiplier.tier-elite     { color: #c084fc; }
.cell.multiplier.tier-master    { color: #ff4d6d; }
.cell.multiplier.tier-ultra     { color: #764ba2; }
.cell.multiplier.tier-legendary { color: gold;    animation: tier-pulse 1.6s ease-in-out infinite; }
.cell.multiplier.tier-supreme   { color: #f5576c; animation: tier-pulse 1.5s ease-in-out infinite; }
.cell.multiplier.tier-epic      { color: #ffa500; animation: tier-pulse 1.4s ease-in-out infinite; }
.cell.multiplier.tier-divine    { color: #4facfe; animation: tier-pulse 1.3s ease-in-out infinite; }
.cell.multiplier.tier-mythic    { color: #fee140; animation: tier-pulse 1.1s ease-in-out infinite; }
.cell.multiplier.tier-celestial { color: #30cfd0; animation: tier-pulse 0.9s ease-in-out infinite; }
@keyframes tier-pulse {
    0%, 100% { box-shadow: inset 0 0 0 2px currentColor, inset 0 0 10px rgba(255, 255, 255, 0.05); }
    50%      { box-shadow: inset 0 0 0 2px currentColor, inset 0 0 20px rgba(255, 255, 255, 0.20), 0 0 14px currentColor; }
}
.legend { font-size: 11px; color: #8b949e; display: flex; gap: 12px; align-items: center; }
.leg-box { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* ─── Multipliers / history strip ─── */
.multipliers {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 48px;
    align-items: center;
    padding: 4px;
}
.multipliers-history { display: flex; flex-direction: column; gap: 8px; }
.mh-row {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 10px;
    align-items: center;
    padding: 6px 8px;
    background: rgba(13, 18, 24, 0.5);
    border-radius: 8px;
    border-left: 2px solid #2a3441;
}
.mh-round { color: #8b949e; font-size: 12px; font-weight: 700; }
.mh-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.mult-tag {
    display: inline-flex;
    align-items: stretch;
    overflow: hidden;
    padding: 0;
    border-radius: 999px;
    border: 1px solid;
    font-weight: 700;
    font-size: 12px;
    background: #1f2937;
    color: #e6edf3;
    transition: transform 120ms, box-shadow 120ms;
}
.mult-tag:hover { transform: translateY(-1px); }
.mult-tag .num {
    background: rgba(0, 0, 0, 0.45);
    padding: 5px 10px;
    font-weight: 800;
    color: inherit;
}
.mult-tag .pay {
    padding: 5px 12px;
    font-weight: 800;
    letter-spacing: 0.3px;
}
.history-strip { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px 2px; }
.history-strip .h-item {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    border: 1px solid #1f2630;
    position: relative;
    cursor: pointer;
    transition: transform 140ms, box-shadow 140ms;
}
.history-strip .h-item:hover {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 2;
}
.h-mult {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 9px;
    font-weight: 800;
    padding: 1.5px 6px;
    border-radius: 999px;
    border: 1px solid;
    line-height: 1.2;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
/* Tiers del badge sobre el círculo del historial */
.h-mult.tier-basic     { background: #6b7280; color: #fff; border-color: #9ca3af; }
.h-mult.tier-standard  { background: #2563eb; color: #fff; border-color: #60a5fa; }
.h-mult.tier-advanced  { background: #16a34a; color: #fff; border-color: #4ade80; }
.h-mult.tier-pro       { background: #f97316; color: #fff; border-color: #fb923c; }
.h-mult.tier-elite     { background: #9333ea; color: #fff; border-color: #c084fc; }
.h-mult.tier-master    { background: crimson; color: #fff; border-color: #ff4d6d; }
.h-mult.tier-ultra     { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border-color: #764ba2; }
.h-mult.tier-legendary { background: gold; color: #2a1d00; border-color: #ffeb70; box-shadow: 0 0 8px rgba(255, 215, 0, 0.6); }
.h-mult.tier-supreme   { background: linear-gradient(135deg, #f093fb, #f5576c); color: #fff; border-color: #f5576c; box-shadow: 0 0 10px rgba(245, 87, 108, 0.5); }
.h-mult.tier-epic      { background: linear-gradient(135deg, #ff6b6b, #ffa500); color: #fff; border-color: #ff6b6b; box-shadow: 0 0 10px rgba(255, 107, 107, 0.5); }
.h-mult.tier-divine    { background: linear-gradient(135deg, #4facfe, #00f2fe); color: #fff; border-color: #4facfe; box-shadow: 0 0 10px rgba(79, 172, 254, 0.5); }
.h-mult.tier-mythic    { background: linear-gradient(135deg, #fa709a, #fee140); color: #fff; border-color: #fee140; box-shadow: 0 0 12px rgba(254, 225, 64, 0.55); }
.h-mult.tier-celestial { background: linear-gradient(135deg, #30cfd0, #330867); color: #fff; border-color: #30cfd0; box-shadow: 0 0 14px rgba(48, 207, 208, 0.6); }

/* Modal de ronda: cabecera con el círculo del ganador */
.round-modal-head {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #1f2630;
}
.round-win-num {
    width: 56px; height: 56px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 2px solid #2a3441;
}
.round-win-info .rmi-title { font-size: 16px; font-weight: 600; margin-top: 4px; }
.resend-all-row {
    margin-top: 16px;
    padding: 14px;
    background: rgba(86, 211, 100, 0.05);
    border: 1px dashed rgba(86, 211, 100, 0.3);
    border-radius: 10px;
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.resend-all-row .btn { white-space: nowrap; }

/* ─── Event log ─── */
.event-log {
    max-height: 240px;
    overflow-y: auto;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
}
.event-log .ev { padding: 2px 0; color: #8b949e; line-height: 1.45; }
.event-log .ev .t { color: #6b7280; margin-right: 8px; }
.event-log .ev.bet    { color: #56d364; }
.event-log .ev.win    { color: #ffd166; }
.event-log .ev.spin   { color: #79c0ff; }
.event-log .ev.cfg    { color: #d2a8ff; }
.event-log .ev.gemini {
    color: #c4b5fd;
    background: rgba(168, 85, 247, 0.07);
    border-left: 2px solid #a855f7;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
}
.event-log .ev.gemini strong { color: #e9d5ff; }
.event-log .ev.gemini-err {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border-left: 2px solid #ef4444;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
}
.event-log .ev.gemini-err strong { color: #fecaca; }
.event-log .ev code {
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: #e6edf3;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}

/* Box del último error de Gemini en la card de Config */
.gemini-err-box {
    margin-top: 14px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 8px;
}
.gemini-err-box .card-h h3 { color: #fca5a5; font-size: 13px; }
.gemini-raw {
    background: #0a0d12;
    color: #f87171;
    border: 1px solid #2a3441;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 4px 0 0;
    font-size: 11.5px;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
}
.event-log .ev .ev-detail { color: #9ca3af; font-size: 11.5px; display: inline-block; margin-top: 1px; }
.event-log .ev .ev-detail.muted { color: #6b7280; }

/* ─── Winners list ─── */
.winners-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.winners-list .w {
    display: flex; justify-content: space-between; padding: 8px 10px;
    background: #0d1218; border-radius: 6px;
}
.winners-list .w .p { color: #8b949e; font-size: 12px; }
.winners-list .w .a { color: #56d364; font-weight: 700; }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: 10px 12px; text-align: left; border-bottom: 1px solid #1f2630;
    font-size: 13px;
}
.data-table th {
    color: #8b949e; font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px;
    background: #0d1218; position: sticky; top: 0;
}
.data-table tbody tr:hover { background: #161b22; }
.data-table .pos { color: #56d364; }
.data-table .neg { color: #f85149; }
.data-table .pill {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    background: #1f2937; color: #e6edf3; font-weight: 600; font-size: 12px;
}

/* ─── Filter bar / buttons ─── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.filter-bar label { color: #8b949e; font-size: 12px; }
.btn {
    background: #1f2937;
    color: #e6edf3;
    border: 1px solid #2a3441;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}
.btn:hover { background: #283241; }
.btn.primary { background: #1f5933; border-color: #2f7d3a; color: #fff; }
.btn.primary:hover { background: #266b3d; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #1a212b; }
.btn.btn-clear { color: #fca5a5; border-color: #5d1f24; }
.btn.btn-clear:hover { background: #2a0e10; border-color: #ef4444; }
.pay-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Estados de loading/success/error para botones de acción */
.btn.btn-loading,
.btn.btn-success,
.btn.btn-error {
    cursor: wait;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 160ms, border-color 160ms;
}
.btn.btn-loading  { opacity: 0.85; }
.btn.btn-success  { background: #166534; border-color: #22c55e; color: #ecfdf5; }
.btn.btn-error    { background: #7f1d1d; border-color: #ef4444; color: #fee2e2; }
.btn-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}
select, input[type=number], input[type=text] {
    background: #0d1218;
    color: #e6edf3;
    border: 1px solid #2a3441;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
}
.muted { color: #8b949e; font-size: 12px; }

/* ─── Reports ─── */
.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.report-grid .full { grid-column: 1 / -1; }
@media (max-width: 900px) { .report-grid { grid-template-columns: 1fr; } }

/* ─── Config ─── */
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .config-grid { grid-template-columns: 1fr; } }
.row { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.row label { display: flex; flex-direction: column; gap: 4px; color: #8b949e; font-size: 12px; }
.row label input, .row label select { min-width: 120px; }
.hint { font-size: 12px; color: #8b949e; margin-top: 6px; }
.switch-row { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; min-width: 220px; }
.switch-title { font-weight: 600; }
.switch-sub { color: #8b949e; font-size: 12px; }
.switch { position: relative; display: inline-block; width: 46px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; inset: 0;
    background: #2a3441;
    border-radius: 999px;
    transition: 200ms;
}
.slider::before {
    content: ""; position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 200ms;
}
.switch input:checked + .slider { background: #2f7d3a; }
.switch input:checked + .slider::before { transform: translateX(22px); }
.gemini-last {
    margin-top: 8px;
    padding: 12px;
    background: rgba(168, 85, 247, 0.06);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 10px;
}
.gemini-last .stat-grid { margin-bottom: 6px; }
.gemini-last .stat-value.pos { color: #c4b5fd; }
.gemini-last .hint strong { color: #d8b4fe; }
.gemini-chat-input {
    list-style: none;
    padding: 6px 10px;
    margin: 4px 0 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid #1f2630;
    max-height: 180px;
    overflow-y: auto;
    font-size: 12px;
}
.gemini-chat-input li {
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    line-height: 1.4;
}
.gemini-chat-input li:last-child { border-bottom: 0; }
.gemini-chat-input .bl-user { margin-right: 6px; }

.state-dump {
    background: #0d1218; padding: 12px; border-radius: 8px;
    font-size: 12px; color: #e6edf3; overflow: auto; max-height: 280px;
    border: 1px solid #1f2630;
}

/* ─── Modal ─── */
.modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 100;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal.show { display: flex; }
.modal-card {
    background: #11161d;
    border: 1px solid #1f2630;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 900px;
    position: relative;
}
.modal-close {
    position: absolute; right: 12px; top: 10px;
    background: transparent; border: 0; color: #8b949e;
    font-size: 28px; cursor: pointer; line-height: 1;
}
.modal-card.modal-num { max-width: 720px; }
.modal-card.modal-num h3 { display: flex; align-items: center; gap: 12px; margin: 0; }
.modal-card.modal-num h3 .pill { font-size: 24px; padding: 4px 16px; background: #1f2937; }

/* ─── Chat profesional ─── */
.chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: #0f141b;
    border: 1px solid #1f2630;
    border-radius: 14px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    z-index: 90;
    overflow: hidden;
    font-size: 13px;
    display: flex;
    flex-direction: column;
}
.chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #161c25, #11161d);
    border-bottom: 1px solid #1f2630;
}
.ch-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ch-logo {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e5933, #2f7d3a);
    display: flex; align-items: center; justify-content: center;
    color: #d3ffd9;
    box-shadow: 0 2px 6px rgba(47, 125, 58, 0.4);
}
.ch-titles { display: flex; flex-direction: column; min-width: 0; }
.ch-title  { font-weight: 700; color: #e6edf3; font-size: 14px; line-height: 1.2; }
.ch-sub    { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #8b949e; }
.ch-dot    { width: 7px; height: 7px; border-radius: 50%; background: #f85149; }
.ch-dot.ok { background: #56d364; box-shadow: 0 0 8px rgba(86, 211, 100, 0.7); animation: ch-pulse 2s ease-in-out infinite; }
@keyframes ch-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.3); opacity: 0.7; }
}
.ch-actions { display: flex; gap: 2px; }
.ch-icon {
    background: transparent;
    border: 0;
    color: #8b949e;
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 120ms, color 120ms;
}
.ch-icon:hover { background: #1f2630; color: #e6edf3; }

.chat-body { display: flex; flex-direction: column; }
.chat-body.hidden { display: none; }

.chat-settings {
    padding: 14px;
    background: #0d1218;
    border-bottom: 1px solid #1f2630;
    display: flex; flex-direction: column; gap: 8px;
}
.chat-settings label { font-size: 12px; color: #8b949e; }
.ch-user-row { display: flex; gap: 8px; }
.ch-user-row input { flex: 1; }

.chat-messages {
    overflow-y: auto;
    padding: 14px;
    height: 380px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #1f2630; border-radius: 4px; }

.ch-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #8b949e;
    text-align: center;
    padding: 20px;
}
.ch-empty-icon { font-size: 36px; opacity: 0.6; }

.cmsg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 85%;
    animation: ch-slide-in 200ms ease-out;
}
@keyframes ch-slide-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cmsg.own { align-self: flex-end; flex-direction: row-reverse; }

.ch-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.cmsg .ch-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.cmsg.own .ch-content { align-items: flex-end; }

.cmsg .ch-meta {
    font-size: 10px;
    color: #6b7280;
    padding: 0 8px;
    letter-spacing: 0.2px;
}
.cmsg .ch-bubble {
    background: #1f2630;
    color: #e6edf3;
    padding: 8px 12px;
    border-radius: 16px 16px 16px 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.cmsg.own .ch-bubble {
    background: linear-gradient(135deg, #1f5933, #2f7d3a);
    color: #ecffec;
    border-radius: 16px 16px 4px 16px;
}
.cmsg .ch-bubble audio {
    display: block;
    margin-top: 6px;
    width: 100%;
    height: 32px;
    filter: invert(0.05);
}

.chat-input {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid #1f2630;
    background: linear-gradient(180deg, #0d1218, #0a0f15);
    align-items: end;
}
.ch-mention { color: #FFD700; font-weight: 700; }
.ch-bubble b { color: inherit; }
.chat-settings input[type="checkbox"] { vertical-align: middle; margin-right: 6px; }

/* Hora junto al username dentro del meta */
.cmsg .ch-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cmsg.own .ch-meta { flex-direction: row-reverse; }
.cmsg .ch-meta .ch-user {
    color: #8b949e;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: color 120ms;
}
.cmsg .ch-meta .ch-user:hover { color: #e6edf3; text-decoration: underline; }
.cmsg .ch-meta .ch-time {
    color: #4b5563;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

/* Textarea más pulido */
.chat-input textarea {
    background: #161c25;
    color: #e6edf3;
    border: 1px solid #2a3441;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    line-height: 1.45;
    transition: border-color 140ms, box-shadow 140ms, background 140ms;
}
.chat-input textarea:hover { background: #1a212b; }
.chat-input textarea:focus {
    outline: none;
    background: #1a212b;
    border-color: #2f7d3a;
    box-shadow: 0 0 0 3px rgba(47, 125, 58, 0.18);
}
.chat-input textarea::placeholder { color: #475569; }
.chat-input textarea {
    background: #1a212b;
    color: #e6edf3;
    border: 1px solid #2a3441;
    border-radius: 14px;
    padding: 9px 14px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    min-height: 38px;
    max-height: 110px;
    line-height: 1.4;
    transition: border-color 120ms, box-shadow 120ms;
}
.chat-input textarea:focus {
    outline: none;
    border-color: #2f7d3a;
    box-shadow: 0 0 0 2px rgba(47, 125, 58, 0.2);
}
.ch-send-btn {
    background: linear-gradient(135deg, #1e5933, #2f7d3a);
    color: #fff;
    border: 0;
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 120ms, box-shadow 120ms;
    box-shadow: 0 2px 6px rgba(47, 125, 58, 0.4);
}
.ch-send-btn:hover { transform: scale(1.05); box-shadow: 0 4px 10px rgba(47, 125, 58, 0.5); }
.ch-send-btn:active { transform: scale(0.95); }
.ch-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.ch-send-btn svg { transform: translateX(-1px); }

/* Cuando el chat está minimizado el header sigue siendo clickeable */
.chat-widget:has(.chat-body.hidden) { width: auto; }
.chat-widget:has(.chat-body.hidden) .ch-titles .ch-sub { display: none; }

/* ─────────────────────────────────────────────────────────────────────────
   Responsive · tablet (≤ 900px)
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .topbar { padding: 10px 14px; gap: 12px; flex-wrap: wrap; }
    .brand .title { font-size: 14px; }
    .tabs {
        order: 3;
        flex-basis: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { white-space: nowrap; padding: 7px 12px; font-size: 12.5px; }
    .conn { font-size: 11px; gap: 6px; }

    .view { padding: 14px 12px; }

    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat { padding: 12px 14px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 10px; letter-spacing: 0.4px; }

    .dashboard-grid { grid-template-columns: 1fr; gap: 10px; }
    .dashboard-grid > .card { grid-column: 1 !important; grid-row: auto !important; }

    .report-grid { grid-template-columns: 1fr; }
    .config-grid { grid-template-columns: 1fr; }

    /* El tablero scrollea horizontal para no comprimir las celdas */
    .roulette-board {
        min-width: 720px;
        grid-template-columns: 50px repeat(12, 1fr) 50px;
        grid-template-rows: repeat(3, 48px) auto auto;
    }
    .card:has(.roulette-board) { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 10px; }
    .cell { font-size: 12px; }
    .cell .num { font-size: 12px; }
    .cell .amount { font-size: 10px; padding: 1px 4px; }

    /* Tablas con scroll horizontal */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 700px; }
    .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }

    /* Modales: full width con margen mínimo */
    .modal { padding: 16px 12px; align-items: stretch; }
    .modal-card { padding: 16px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; }
    .modal-card.modal-num h3 .pill { font-size: 18px; padding: 3px 12px; }

    /* Chat: ancho casi completo, scroll en mensajes más corto */
    .chat-widget {
        right: 10px;
        left: 10px;
        bottom: 10px;
        width: auto;
        max-width: none;
    }
    .chat-widget:has(.chat-body.hidden) {
        left: auto;
        width: auto;
    }
    .chat-messages { height: 320px; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Responsive · phone (≤ 600px)
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat { padding: 10px 12px; }
    .stat-value { font-size: 20px; }

    .modal-card.modal-num .stat-grid { grid-template-columns: 1fr 1fr; }
    .modal-card.modal-num .stat-value { font-size: 16px; }
    .modal-card.modal-num .stat { padding: 8px 10px; }
    .modal-card.modal-num .row { gap: 8px; }
    .modal-card.modal-num .btn { font-size: 12px; padding: 6px 10px; }

    .row { gap: 8px; }
    .row label { font-size: 11px; }
    .btn { padding: 8px 12px; font-size: 12.5px; }
    .filter-bar { gap: 8px; }
    .filter-bar .btn { padding: 6px 10px; font-size: 12px; }

    .multipliers { gap: 6px; }
    .mh-row { grid-template-columns: 38px 1fr; gap: 6px; padding: 4px 6px; }
    .mult-tag { font-size: 11px; }
    .mult-tag .num { padding: 4px 8px; }
    .mult-tag .pay { padding: 4px 10px; }

    .chat-widget { right: 6px; left: 6px; bottom: 6px; border-radius: 12px; }
    .chat-messages { height: 280px; padding: 10px 12px; }
    .chat-input { padding: 8px 10px; }
    .ch-avatar { width: 26px; height: 26px; font-size: 11px; }

    .event-log { max-height: 180px; font-size: 11px; }

    /* Modal de número: cards 2x3 y acciones apiladas */
    .modal-card.modal-num h3 { font-size: 14px; }
    .modal-card.modal-num .row { flex-direction: column; align-items: stretch; }
    .modal-card.modal-num .row label { width: 100%; }
    .modal-card.modal-num .row button { width: 100%; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Responsive · phone chico (≤ 400px)
   ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 400px) {
    .topbar { padding: 8px 10px; gap: 8px; }
    .brand .title { font-size: 13px; }
    .conn span { display: none; }
    .conn .dot { display: inline-block; }

    .stat-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 18px; }

    .view { padding: 10px; }
    .tab { padding: 6px 10px; font-size: 12px; }

    .chat-messages { height: 240px; }
}
