/* WebTrader Pro - Ultra UI */
:root{
  --bg:#0d1016;--surface:#121621;--surface-2:#161b27;--text:#e5e7eb;--muted:#8b93a6;
  --primary:#00c2ff;--primary-2:#2ea6ff;--success:#00d4aa;--warning:#ffb703;--danger:#ff4757;
  --border:#202635;--radius:10px;--shadow:0 8px 30px rgba(0,0,0,.35);
  --font:'Inter',system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Noto Sans";
}

/* Base */
.webtrader-body{background:var(--bg);color:var(--text);font-family:var(--font);line-height:1.25}
.webtrader-body *{box-sizing:border-box}

/* Container */
.webtrader-container{width:100%;max-width:100%;margin:0;padding:24px}
.trading-controls-section{margin-bottom:16px}
.trading-controls{display:flex;gap:12px;flex-wrap:wrap}

/* Grid Layout (Match-Trade style) */
.webtrader-grid{display:grid;grid-template-columns:420px minmax(0,1fr);gap:16px;align-items:start}
.left-sidebar{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden;position:sticky;top:72px;height:calc(100vh - 108px)}
.left-sidebar .market-watch{height:100%;max-height:none;overflow-y:auto;overflow-x:hidden}
.center-pane{display:flex;flex-direction:column;gap:24px}
.bottom-row{grid-column:1 / -1}

/* Data status bar removida */
/* .data-status-bar{display:flex;align-items:center;gap:10px;padding:8px 12px;background:var(--surface);border:1px solid var(--border);border-radius:10px;color:var(--muted)} */

/* Market Watch header tools */
.market-watch-header{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;border-bottom:1px solid var(--border)}
.market-watch-header .mw-header-right{display:flex;align-items:center;gap:10px}
.mw-tools{display:flex;align-items:center;gap:8px}
.mw-search{display:flex;align-items:center;background:var(--surface-2);border:1px solid var(--border);border-radius:999px;padding:6px 10px;color:var(--muted)}
.mw-search i{margin-right:6px}
.mw-search input{background:transparent;border:none;outline:none;color:var(--text);width:160px}
.chip{background:var(--surface-2);border:1px solid var(--border);color:var(--muted);border-radius:999px;padding:6px 12px;font-size:12px;cursor:pointer}
.chip.active{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#0b1220;border:none}

/* Sortable headers */
#marketWatchTable thead th{position:relative;font-weight:600;color:var(--muted)}
#marketWatchTable thead th.sortable{cursor:pointer}
#marketWatchTable thead th .sort-icon{margin-left:6px;color:var(--muted)}
#marketWatchTable thead th.sorted-asc .sort-icon{color:var(--primary)}
#marketWatchTable thead th.sorted-desc .sort-icon{color:var(--primary)}

/* Density toggle */
.market-watch.dense #marketWatchTable td,.market-watch.dense #marketWatchTable th{padding:6px 8px}
.market-watch #marketWatchTable td,.market-watch #marketWatchTable th{padding:10px 12px}

/* Search highlight */
#marketWatchTable .symbol mark{background:rgba(46,166,255,.25);color:var(--text);border-radius:4px;padding:0 2px}

/* Símbolo con flags e información secundaria */
#marketWatchTable td.symbol{display:flex;align-items:center;gap:10px}
.asset-flags{font-size:18px;line-height:1}
.symbol-flags{display:inline-flex;align-items:center;gap:4px;margin-right:2px}
.symbol-lines{display:flex;flex-direction:column;gap:2px}
.symbol-main{font-weight:700}
.symbol-sub{font-size:12px;color:var(--muted)}

/* Spread cell */
#marketWatchTable td.spread{color:#cbd5e1}
/* .data-status-bar .status-pill{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border-radius:999px;border:1px solid var(--border);background:rgba(255,255,255,.04);font-weight:600;color:var(--text)}
.data-status-bar .status-sep{color:var(--border)} */

/* Buttons */
.btn{appearance:none;background:var(--surface-2);color:var(--text);border:1px solid var(--border);
  padding:10px 16px;border-radius:8px;font-weight:600;letter-spacing:.01em;transition:background .2s,box-shadow .2s,transform .08s}
.btn:hover{background:#1a2130;box-shadow:0 6px 20px rgba(0,194,255,.12)}
.btn:active{transform:translateY(1px)}
.btn-success{background:linear-gradient(135deg,var(--success),#00b894);border:none}
.btn-info{background:linear-gradient(135deg,var(--primary),var(--primary-2));border:none}
.btn-warning{background:linear-gradient(135deg,var(--warning),#f59e0b);border:none}
.btn-outline-primary{background:transparent;border:1px solid var(--primary);color:var(--primary)}
.btn-outline-danger{background:transparent;border:1px solid var(--danger);color:var(--danger)}
/* Button variants - professional finish */
.btn:disabled{opacity:.6;cursor:not-allowed;box-shadow:none}
.btn-sm{padding:8px 12px;border-radius:8px;font-size:12px}
.btn-lg{padding:12px 18px;border-radius:10px;font-size:14px}
.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary-2));border:none;color:#0b1220}
.btn-danger{background:linear-gradient(135deg,var(--danger),#e11d48);border:none}
.btn-secondary{background:linear-gradient(135deg,#64748b,#475569);border:none}
.btn-outline-secondary{background:transparent;border:1px solid #64748b;color:#cbd5e1}
/* Accessible focus states */
.btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.user-menu-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.user-dropdown .dropdown-item:focus-visible{background:#1a2130}

/* Header */
.webtrader-header{position:sticky;top:0;background:linear-gradient(180deg,rgba(18,22,33,.98),rgba(18,22,33,.92));border-bottom:1px solid var(--border);backdrop-filter:saturate(1.2) blur(6px);z-index:50}
.webtrader-header,.webtrader-header .header-right{display:flex;align-items:center}
.webtrader-header .header-right{flex-wrap:nowrap}
.webtrader-header{padding:12px 20px;justify-content:space-between}
.header-brand{display:flex;align-items:center;gap:12px}
.brand-logo{width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;background:rgba(0,194,255,.12);color:var(--primary);border:1px solid rgba(0,194,255,.35)}
.brand-logo{transition:transform .18s ease, box-shadow .25s ease}
.brand-logo:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(0,194,255,.18)}
.brand-text{font-weight:700;font-size:16px;letter-spacing:.02em}
.status-area{display:flex;align-items:center}
.connection-pill{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:999px;border:1px solid var(--border);background:rgba(255,255,255,.04);color:var(--text);box-shadow:0 8px 24px rgba(0,0,0,.25);transition:background .25s ease, border-color .25s ease, box-shadow .25s ease}
.connection-pill i{font-size:14px}
.connection-pill.connected{background:linear-gradient(135deg,rgba(0,212,170,.18),rgba(0,212,170,.28));border-color:rgba(0,212,170,.35);color:var(--success);animation:pulseConnection 1.8s ease-in-out infinite}
.connection-pill.disconnected{background:linear-gradient(135deg,rgba(255,183,3,.18),rgba(255,183,3,.28));border-color:rgba(255,183,3,.35);color:var(--warning)}
.connection-pill .status-text{font-weight:600;font-size:12px}
.connection-pill .latency{font-size:12px;opacity:.85}
.header-right{gap:16px}
.header-right > *{flex:0 0 auto}
.header-actions,.trading-actions{display:flex;gap:10px;align-items:center;flex-wrap:nowrap}
.header-actions .btn,.trading-actions .btn{padding:8px 14px;border-radius:8px}

/* Header action buttons (ultra luxury) */
.action-btn{appearance:none;border:none;background:var(--surface-2);color:var(--text);border:1px solid var(--border);padding:10px 14px;border-radius:10px;font-weight:700;display:inline-flex;align-items:center;gap:8px;cursor:pointer;transition:background .2s, box-shadow .2s, transform .08s}
.btn-unified{height:40px;min-width:140px;justify-content:center}
/* Fijar ancho consistente para los tres botones principales del header */
.trading-actions .btn-unified{width:160px}
.action-btn i{font-size:14px}
.action-btn:hover{background:#1a2130;box-shadow:0 8px 24px rgba(0,194,255,.14)}
.action-btn:active{transform:translateY(1px)}
.order-btn{border-color:rgba(46,166,255,.35)}
.order-btn i{color:var(--primary)}
.deposit-btn{border-color:rgba(0,212,170,.35)}
.deposit-btn i{color:var(--success)}
.withdraw-btn{border-color:rgba(255,71,87,.35)}
.withdraw-btn i{color:var(--danger)}

/* Header tool buttons */
.header-btn{appearance:none;background:var(--surface-2);border:1px solid var(--border);color:var(--text);width:36px;height:36px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .2s, box-shadow .2s}
.header-btn.btn-icon{width:40px;height:40px}

/* Mini buscador en el header */
.mini-search{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2)}
.mini-search i{color:var(--text-muted);font-size:14px}
.mini-search input{border:none;outline:none;background:transparent;color:var(--text);width:150px;font-size:13px}
.mini-search input::placeholder{color:var(--text-muted)}
@media (max-width:900px){.mini-search{display:none}}
.header-btn:hover{background:#1a2130;box-shadow:0 6px 18px rgba(0,0,0,.25)}

/* Focus visible for accessibility */
.action-btn:focus-visible,.header-btn:focus-visible,.user-menu-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}

/* User menu (ultra) */
.user-menu{position:relative}
.user-menu-btn{appearance:none;background:rgba(255,255,255,.04);border:1px solid var(--border);color:var(--text);padding:8px 10px;border-radius:12px;display:flex;align-items:center;gap:10px;cursor:pointer;transition:background .2s, box-shadow .2s}
.user-menu-btn:hover{background:#1a2130;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.user-avatar{width:28px;height:28px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;background:rgba(46,166,255,.14);color:var(--primary);border:1px solid rgba(46,166,255,.35)}
.user-avatar-large{width:48px;height:48px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;background:rgba(46,166,255,.14);color:var(--primary);border:1px solid rgba(46,166,255,.35)}
.user-info{display:flex;flex-direction:column;line-height:1.1}
.user-name{font-weight:700;font-size:12px}
.user-email{color:var(--muted);font-size:11px}
.dropdown-arrow{color:var(--muted)}
.user-dropdown{position:absolute;right:0;top:calc(100% + 8px);min-width:260px;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow);padding:10px;display:none}
.user-dropdown{opacity:0;transform:translateY(6px);pointer-events:none;transition:opacity .18s ease, transform .18s ease}
.user-dropdown.show{display:block;opacity:1;transform:translateY(0);pointer-events:auto}
.user-dropdown .dropdown-header{display:flex;align-items:center;gap:10px;padding:8px 10px;border-bottom:1px solid var(--border)}
.user-dropdown .dropdown-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;color:var(--text);text-decoration:none}
.user-dropdown .dropdown-item:hover{background:#1a2130}
.user-dropdown .dropdown-divider{height:1px;background:var(--border);margin:6px 4px}
.user-dropdown .logout{color:#fff}
.user-dropdown .logout-blue{background:linear-gradient(135deg,#2ea6ff,#1b7bd3);border:1px solid rgba(46,166,255,.35)}
.user-dropdown .logout-blue:hover{filter:brightness(1.06)}

/* Professional checkbox */
.wt-checkbox{display:inline-flex;align-items:center;gap:10px;cursor:pointer;user-select:none}
.wt-checkbox input{appearance:none;width:18px;height:18px;margin:0;position:absolute;opacity:0}
.wt-checkbox .checkbox-ui{width:18px;height:18px;border-radius:4px;border:1px solid var(--border);background:var(--surface-2);display:inline-flex;align-items:center;justify-content:center;transition:background .18s ease,border-color .18s ease}
.wt-checkbox.checked .checkbox-ui{background:linear-gradient(135deg,var(--primary),var(--primary-2));border-color:transparent}
.wt-checkbox .checkbox-ui::after{content:'\2713';color:#0b111a;font-size:12px;opacity:0;transform:scale(.8);transition:opacity .18s ease, transform .18s ease}
.wt-checkbox.checked .checkbox-ui::after{opacity:1;transform:scale(1)}

/* Input error inline */
.input-error{color:var(--danger);font-size:12px;margin-top:6px}

/* Account summary inside header */
.account-summary{display:flex;gap:14px;padding:10px 14px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.account-item{display:flex;flex-direction:column;gap:4px}
.account-item .label{color:var(--muted);font-size:11px;letter-spacing:.03em}
.account-item .value{font-weight:700;font-variant-numeric:tabular-nums}
/* Selector de cuenta en header */
.account-select{appearance:none;background:var(--surface-2);border:1px solid var(--border);color:var(--text);padding:8px 10px;border-radius:8px;min-width:320px;cursor:pointer}
.account-select:hover{border-color:var(--border-strong)}
/* Indicador de margin level */
.ml-pill{margin-left:8px;color:var(--muted);background:rgba(255,255,255,.04);border:1px solid var(--border);border-radius:999px;padding:2px 8px;font-size:11px}
/* Estados por umbral */
.ml-pill.good{color:#00d4aa;border-color:rgba(0,212,170,.35);background:rgba(0,212,170,.08)}
.ml-pill.warn{color:#f5a623;border-color:rgba(245,166,35,.35);background:rgba(245,166,35,.10)}
.ml-pill.bad{color:#ff4d4f;border-color:rgba(255,77,79,.35);background:rgba(255,77,79,.10)}
/* Control de cuenta fuera de KPIs */
.account-control{display:flex;align-items:center;gap:10px;background:var(--surface-2);padding:6px 10px;border-radius:10px;box-shadow:var(--shadow)}
.account-number-badge{display:inline-flex;align-items:center;gap:6px;font-weight:600;background:var(--surface-3);color:var(--text);padding:4px 10px;border-radius:999px;transition:background .18s ease, transform .12s ease}
.account-number-badge:hover{background:var(--surface-4);transform:translateY(-1px)}
.account-number-badge .sep{color:var(--muted)}
/* Ocultar sección de selector en modal si ya existe en header */
.has-header-account-selector #settingsModal .account-selector-section{display:none}

/* Estado textual al lado del Margin Level */
.ml-state{margin-left:8px;font-size:12px;color:var(--muted)}
.ml-state.ok{color:#00d4aa}
.ml-state.warn{color:#f5a623}
.ml-state.risk{color:#ff4d4f}
.ml-link{margin-left:8px;font-size:12px;color:var(--primary);text-decoration:none}
.ml-link:hover{text-decoration:underline}

/* Mini-estado de riesgo junto al selector/badge */
.risk-state{margin-left:8px;font-size:12px;color:var(--muted);background:rgba(255,255,255,.04);border:1px solid var(--border);border-radius:999px;padding:2px 8px}
.risk-state.ok{color:#00d4aa;border-color:rgba(0,212,170,.35);background:rgba(0,212,170,.08)}
.risk-state.warn{color:#f5a623;border-color:rgba(245,166,35,.35);background:rgba(245,166,35,.10)}
.risk-state.risk{color:#ff4d4f;border-color:rgba(255,77,79,.35);background:rgba(255,77,79,.10)}

/* Iconos de estado (texto/mini) */
.ml-icon{margin-left:6px;font-size:13px;line-height:1;color:var(--muted);vertical-align:middle}
.ml-icon.ok{color:#00d4aa}
.ml-icon.warn{color:#f5a623}
.ml-icon.risk{color:#ff4d4f}
.risk-icon{margin-left:4px;font-size:12px;color:var(--muted);vertical-align:middle}
.risk-icon.ok{color:#00d4aa}
.risk-icon.warn{color:#f5a623}
.risk-icon.risk{color:#ff4d4f}

/* Dropdown menu */
.dropdown{position:relative}
.dropdown-toggle{appearance:none;background:var(--surface-2);border:1px solid var(--border);color:var(--text);padding:8px 12px;border-radius:8px;display:flex;align-items:center;gap:8px;cursor:pointer}
.dropdown-menu{position:absolute;right:0;top:calc(100% + 8px);min-width:220px;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow);padding:8px;display:none}
.dropdown.open .dropdown-menu{display:block}
.dropdown-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;color:var(--text);text-decoration:none}
.dropdown-item:hover{background:#1a2130}
.dropdown-divider{height:1px;background:var(--border);margin:6px 4px}
.dropdown-item.logout{color:var(--danger)}

/* Market Watch */
.top-assets-menu{margin:10px 0}
.market-watch-container{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.market-watch-header{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;background:var(--surface-2);border-bottom:1px solid var(--border)}
.market-watch-header .data-source{color:var(--muted);font-size:12px}
.mw-header-right{display:flex;align-items:center;gap:8px}
.market-watch{width:100%;max-height:320px;overflow-y:auto;overflow-x:hidden;position:relative}
.mw-adv-overlay{position:absolute;inset:0;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:10px;z-index:1000;overflow-y:auto}
.mw-adv-overlay .order-advanced-panel{width:100%;max-width:none;margin:0}
.market-watch-container.adv-mode .mw-list-header{display:none}
.market-watch-container.adv-mode .mw-category{display:none !important}
.market-watch-container.adv-mode .mw-category-header{display:none !important}
.market-watch-container.adv-mode .mw-item{display:none !important}
.market-watch-container.adv-mode .mw-item-header{display:none !important}
.market-watch-container.adv-mode .mw-category-body{display:none !important}
.market-watch-container.adv-mode .mw-item-actions{display:none !important}
.market-watch-container.adv-mode .mw-quick-actions{display:none}
.market-watch-container.adv-mode .market-watch{overflow:hidden}
.market-watch-container.adv-mode .market-watch::-webkit-scrollbar{display:none}
/* Ocultar todo lo que no sea el overlay dentro de la lista */
.market-watch-container.adv-mode #mwList > :not(#mwAdvOverlay){display:none !important}
.market-watch-container.adv-mode .mw-adv-overlay{display:block}
.mw-list-header{display:grid;grid-template-columns:24px minmax(0,1fr) 110px 96px;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--border);color:var(--muted);font-weight:600}
.mw-list-header > .mw-header-col:nth-child(3){text-align:center;justify-self:center}
.mw-list-header > .mw-header-col:nth-child(4){text-align:center;justify-self:center}
.market-watch table{width:100%;border-collapse:collapse}
/* Ensure columns fit container without horizontal scroll */
.market-watch table{table-layout:fixed}
.market-watch thead th:nth-child(1){text-align:left}
.market-watch thead th:nth-child(2),
.market-watch thead th:nth-child(3){text-align:right}
.market-watch th,.market-watch td{vertical-align:middle}
.market-watch th+th,.market-watch td+td{border-left:1px solid var(--border)}
.market-watch tbody td.symbol{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.market-watch thead th:nth-child(1), .market-watch tbody td:nth-child(1){width:50%}
.market-watch thead th:nth-child(2), .market-watch tbody td:nth-child(2){width:25%}
.market-watch thead th:nth-child(3), .market-watch tbody td:nth-child(3){width:25%}
.market-watch td.num, .market-watch td.price, .market-watch td.change, .market-watch td.change-percent, .market-watch td.spread{white-space:nowrap;text-align:right;font-variant-numeric:tabular-nums}
.market-watch th,.market-watch td{padding:10px 12px;border-bottom:1px solid var(--border)}
.market-watch tbody tr{transition:background .18s ease, box-shadow .18s ease}
.market-watch tbody tr:hover{background:#151b27}
.market-watch tbody tr:nth-child(even){background:rgba(255,255,255,.01)}
.market-watch tbody tr.selected{background:rgba(46,166,255,.06);box-shadow:inset 0 0 0 1px rgba(46,166,255,.25)}
.market-watch tbody tr{cursor:pointer}
.market-watch tbody tr:focus-visible{outline:2px solid var(--primary);outline-offset:-2px}
.market-watch .price-up{color:var(--success)}
.market-watch .price-down{color:var(--danger)}

/* Quick Actions for Market Watch rows */
.market-watch tbody tr{position:relative}
.mw-quick-actions{position:absolute;right:10px;top:50%;transform:translateY(-50%) scale(.98);opacity:0;display:none;gap:8px;transition:opacity .18s ease, transform .18s ease}
.market-watch tbody tr.actions-open .mw-quick-actions{display:flex;opacity:1;transform:translateY(-50%) scale(1)}
.mw-qa-btn{font-size:12px;line-height:1;border:none;border-radius:999px;padding:8px 12px;color:#fff;background:#111827;box-shadow:0 4px 16px rgba(0,0,0,0.25);transition:opacity .15s ease,transform .08s ease}
.mw-qa-btn:hover{opacity:.9;transform:translateY(-1px)}
.mw-qa-btn.quick-buy{background:linear-gradient(180deg,#064e3b,#022c22)}
.mw-qa-btn.quick-sell{background:linear-gradient(180deg,#7f1d1d,#450a0a)}
.mw-qa-btn.favorite-toggle{background:linear-gradient(180deg,#8b5cf6,#5b21b6)}
.mw-qa-btn .fa-star{margin-left:6px}
.favorite-active .fa-star{color:#fbbf24}

/* Action row that expands below the asset */
.mw-row-actions{display:none;background:var(--surface-2)}
.mw-row-actions.open{display:table-row}
.mw-row-actions td{border-bottom:1px solid var(--border)}
.mw-row-actions .actions-content{padding:8px 12px}
.mw-row-actions .mw-quick-actions{position:static;transform:none;opacity:1;display:flex;justify-content:flex-start;gap:8px}

/* Tarjeta de orden expandible */
.order-card{background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow);padding:10px;display:flex;flex-direction:column;gap:10px;position:relative}
.order-card.adv-open .order-main{display:none !important}
.order-card.adv-open .order-footer{display:none !important}
.order-card.adv-open .mw-quick-actions{display:none !important}
.order-main{display:grid;grid-template-columns:repeat(3, 1fr);gap:10px;align-items:center}
.order-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px;border-radius:12px;font-weight:800;line-height:1.1;border:1px solid var(--border);height:88px;width:100%}
.order-btn.sell{background:linear-gradient(135deg,rgba(255,71,87,.25),rgba(255,71,87,.15));color:#fee;}
.order-btn.buy{background:linear-gradient(135deg,rgba(0,212,170,.25),rgba(0,212,170,.15));color:#eafff7;}
.order-btn .order-price{display:block;margin-top:6px;font-weight:700}
.order-size{display:flex;flex-direction:column;align-items:center;gap:4px;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:10px;height:88px;width:100%}
.order-size .size-value{font-weight:700}
.order-size .size-sub{font-size:12px;color:var(--muted)}
.order-size .size-controls{display:flex;gap:6px}
.order-size .size-controls .btn{padding:6px 10px;height:28px;font-size:14px;border-radius:8px;line-height:1}
@media (max-width: 480px){
  .order-size .size-controls .btn{padding:4px 8px;height:24px;font-size:13px}
}
.order-main.mobile{grid-template-columns:1fr}
.order-btn{min-height:96px}
.order-size{min-height:96px}
.order-advanced{display:flex;flex-direction:column;gap:8px}
.order-advanced .adv-title{color:var(--muted);font-weight:600}
.order-advanced .adv-grid{display:grid;grid-template-columns:repeat(6, minmax(0,1fr));gap:6px}

/* Footer de la tarjeta de orden */
.order-footer{display:flex;align-items:center;justify-content:space-between;margin-top:6px}
.order-advanced-btn{appearance:none;background:transparent;border:1px dotted var(--border);color:var(--muted);padding:6px 10px;border-radius:8px;display:inline-flex;align-items:center;gap:8px;cursor:pointer}
.order-advanced-btn:hover{color:var(--text);border-style:solid}

/* Acciones rápidas debajo de la tarjeta */
.mw-qa-btn{appearance:none;background:var(--surface-2);border:1px solid var(--border);color:var(--text);padding:8px 12px;border-radius:8px;font-weight:600;cursor:pointer}
.favorite-toggle{appearance:none;background:transparent;border:1px solid var(--border);color:var(--muted);padding:6px 10px;border-radius:999px;display:inline-flex;align-items:center;gap:6px;cursor:pointer}
.favorite-toggle.favorite-active{background:linear-gradient(135deg,#2ea6ff,#00c2ff);border-color:transparent;color:#0b1220}
.favorite-active .fa-star{color:#0b1220}

/* Estado visual al abrir acciones */
#marketWatchTable tbody tr.actions-open{background:rgba(255,255,255,.02)}
.market-watch tbody tr.actions-open{background:#151b27}

/* Trading chart */
.chart-area{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}

/* Panels + tables */
.positions-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.positions-table .table tbody tr:hover{background:#151b27}
.positions-table .table th,.positions-table .table td{font-size:12px}
.positions-table .table td.symbol .sym-wrap{display:flex;align-items:center;gap:10px}
.positions-table .table td.symbol .opened-at{color:var(--muted);font-size:11px}

/* Badges */
.badge-danger{background:rgba(255,71,87,.18);color:var(--danger);border:1px solid rgba(255,71,87,.35)}

/* Footer */
.webtrader-footer{margin-top:20px;padding:14px 20px;background:var(--surface);border-top:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;color:var(--muted)}

/* Header microinteractions */
.alert-badge{display:inline-flex;align-items:center;justify-content:center;min-width:16px;height:16px;border-radius:999px;background:var(--danger);color:#fff;font-size:10px;font-weight:700;box-shadow:0 6px 14px rgba(255,71,87,.35);transform-origin:center;transition:filter .2s ease}
.alert-badge.bump{animation:badgeBump .35s ease}
.header-btn#alertsBtn:hover .alert-badge{filter:brightness(1.05)}

/* Ripple effect */
.action-btn, .header-btn{position:relative;overflow:hidden}
.ripple-circle{position:absolute;border-radius:50%;background:rgba(255,255,255,.5);transform:scale(0);animation:rippleExpand .5s ease-out;pointer-events:none}
@keyframes rippleExpand{to{transform:scale(2.5);opacity:0}}

@keyframes badgeBump{0%{transform:scale(1)}40%{transform:scale(1.25)}100%{transform:scale(1)}}

@keyframes pulseConnection{0%{box-shadow:0 0 0 0 rgba(0,212,170,.35)}70%{box-shadow:0 0 0 8px rgba(0,212,170,0)}100%{box-shadow:0 0 0 0 rgba(0,212,170,0)}}

/* Theme icon spin on toggle */
.spin-once{animation:spinOnce .35s ease}
@keyframes spinOnce{0%{transform:rotate(0)}100%{transform:rotate(180deg)}}

/* Modals */
.modal{position:fixed;top:0;left:0;width:100vw;height:100vh;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,.5);backdrop-filter:blur(2px);z-index:9999;pointer-events:auto}
.modal.active{display:flex}
.modal-content{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:min(760px,92vw);max-height:85vh;overflow-y:auto;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow)}
.modal-header{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;background:var(--surface-2);border-bottom:1px solid var(--border)}
.modal-body{padding:16px;display:grid;gap:16px}
.modal-footer{padding:12px 16px;border-top:1px solid var(--border);display:flex;gap:10px;justify-content:flex-end;background:var(--surface)}
.close-modal{appearance:none;background:transparent;border:none;color:var(--muted);font-size:20px;cursor:pointer}
.close-modal:hover{color:var(--text)}

/* Desactivar interacciones del header mientras hay modal */
body.modal-open .header-actions,
body.modal-open .trading-actions{pointer-events:none}
body.modal-open .action-btn:active,
body.modal-open .header-btn:active{transform:none !important}

.balance-info{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.balance-info .balance-item{background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:10px}
.balance-info .label{font-size:12px;color:var(--muted)}
.balance-info .value{font-weight:700}

.deposit-form,.withdraw-form{display:grid;gap:12px}
.form-group{display:grid;gap:6px}
.form-group select,.form-group input{background:var(--surface-2);border:1px solid var(--border);border-radius:8px;color:var(--text);padding:10px 12px}
.form-text{font-size:12px;color:var(--muted)}
.deposit-info,.withdraw-info{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.deposit-info .info-item,.withdraw-info .info-item{display:flex;align-items:center;gap:8px;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:8px 10px}
.form-actions{display:flex;justify-content:flex-end;gap:10px}

/* Responsive */
@media (max-width: 1024px){
  .account-summary{display:none}
  .webtrader-header{padding:10px 12px}
  /* Make grid single column to let Market Watch span full width */
  .webtrader-grid{grid-template-columns:minmax(0,1fr)}
  .left-sidebar{position:static;height:auto}
}
@media (max-width: 768px){
  .panel-tabs{flex-wrap:wrap}
  .trading-controls{gap:8px}
  .header-actions{display:none}
}

@media (max-width: 768px){
  .mw-item-header{grid-template-columns:24px minmax(0,1fr) 100px 88px}
  .mw-item-price{min-width:auto}
  .mw-item-change-percent{min-width:86px}
  .order-main{grid-template-columns:1fr}
  .order-size{order:3}
  .modal-content{width:100vw;max-width:100vw;height:100vh;max-height:100vh;border-radius:0}
  .modal-header{position:sticky;top:0;z-index:2}
  .modal-body{padding:16px}
  .modal-footer{position:sticky;bottom:0;z-index:2}
  .chart-area canvas{height:360px}
}

@media (max-width: 480px){
  .webtrader-container{padding:14px}
  .mw-item-header{grid-template-columns:20px minmax(0,1fr) 90px 78px}
  .mw-list-header{grid-template-columns:20px minmax(0,1fr) 90px 78px}
  .mw-item-symbol{font-size:12px}
  .mw-item-price{font-size:12px}
  .mw-item-change-percent{font-size:11px}
  .order-btn{height:92px}
  .order-size{height:92px}
  .tf-btn{padding:6px 8px}
  .chart-area canvas{height:300px}
}

/* Banner de invitado removido */
.full-width-chart{margin:18px 0}
.chart-container{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.chart-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border)}
/* Layout centrado premium para el header del gráfico */
.chart-header.three-cols{display:grid;grid-template-columns:1fr auto 1fr;align-items:center}
.chart-header.three-cols .symbol-info{justify-self:start}
.chart-header.three-cols .timeframe-selector{justify-self:center}
.chart-header.three-cols .chart-tools{justify-self:end}
.symbol-info{display:flex;align-items:baseline;gap:10px}
.symbol-name{font-size:18px;font-weight:700}
.symbol-price{font-weight:700}
.symbol-change{font-size:12px;color:var(--success)}
.symbol-pnl{font-size:12px;font-weight:700}
.symbol-pnl.profit{color:var(--success)}
.symbol-pnl.loss{color:var(--danger)}
.symbol-open-count{font-size:12px;color:var(--muted)}
.timeframe-selector{display:flex;gap:8px}
.tf-btn{background:var(--surface-2);border:1px solid var(--border);color:var(--text);padding:8px 10px;border-radius:8px;font-size:12px;cursor:pointer}
.tf-btn:hover{background:#1a2130}
.tf-btn.active{background:var(--primary);color:#0b111a;border-color:transparent}
.tf-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.chart-area{padding:8px}
.chart-area canvas{width:100%;height:480px;display:block}
.chart-area{overflow:hidden}
/* Relative updated time subtext inside symbol cell */
#marketWatchTable .symbol .mw-updated{display:block;color:var(--muted);font-size:11px;margin-top:2px}

/* Extra small: hide change % to avoid overflow */
@media (max-width: 360px){
  .market-watch thead th:nth-child(3), .market-watch tbody td:nth-child(3){display:none}
  .market-watch thead th:nth-child(1), .market-watch tbody td:nth-child(1){width:60%}
  .market-watch thead th:nth-child(2), .market-watch tbody td:nth-child(2){width:40%}
}

/* Ultra luxury styling for Market Watch */
.market-watch.luxury{background:linear-gradient(180deg, rgba(20,24,33,.72), rgba(12,15,22,.72));border:1px solid rgba(255,255,255,.06);border-radius:16px;box-shadow:0 12px 40px rgba(0,0,0,.35)}
.market-watch.luxury table{border-collapse:separate;border-spacing:0}
.market-watch.luxury thead th{position:sticky;top:0;z-index:2;background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);font-weight:600;letter-spacing:.02em}
.market-watch.luxury thead th::after{content:'';position:absolute;left:0;right:0;bottom:-1px;height:1px;background:var(--border)}
.market-watch.luxury tbody tr:hover{background:rgba(255,255,255,.03)}
.market-watch.luxury tbody tr.selected{background:rgba(46,166,255,.08)}
.market-watch.luxury td.symbol{display:flex;align-items:center;gap:8px}
.market-watch.luxury td.symbol::before{content:'';display:inline-block;width:6px;height:6px;border-radius:50%;margin-right:2px;background:radial-gradient(circle at 30% 30%, #3b82f6, #0ea5e9);box-shadow:0 0 0 2px rgba(14,165,233,.15)}
.market-watch .price{font-weight:600}
.market-watch .change-percent{display:inline-flex;align-items:center;gap:6px;padding:4px 8px;border-radius:999px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.06);transition:background-color .12s ease, color .12s ease, border-color .12s ease}
.market-watch .change-percent.positive{color:var(--success);background:rgba(34,197,94,.12);border-color:rgba(34,197,94,.25)}
.market-watch .change-percent.negative{color:var(--danger);background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.25)}
.change-percent .trend-icon{font-size:11px;opacity:.85}

/* New Market Watch List UI */
.mw-list{display:flex;flex-direction:column;gap:10px;padding:10px 12px 12px;overflow-x:hidden}
.market-watch-container{overflow-x:hidden}
.mw-list-header{display:grid;grid-template-columns:24px minmax(0,1fr) 110px 96px;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--border);color:var(--muted);font-weight:600;font-size:12px}
.mw-list-header .mw-header-empty{display:flex;align-items:center;justify-content:center;width:24px;height:18px}
.mw-list-header .mw-header-col{letter-spacing:.02em}
.mw-list-header .mw-header-col:nth-child(3){text-align:center;justify-self:center}
.mw-list-header .mw-header-col:nth-child(4){text-align:center;justify-self:center}
.mw-item{border:1px solid var(--border);border-radius:12px;background:var(--surface);box-shadow:0 6px 20px rgba(0,0,0,.18);overflow:hidden}
.mw-item-header{display:grid;grid-template-columns:24px minmax(0,1fr) 110px 96px;align-items:center;gap:8px;padding:10px 12px;cursor:pointer;box-sizing:border-box;font-size:13px}
.mw-item-header:hover{background:var(--surface-2)}
.mw-item-symbol{display:flex;align-items:center;justify-content:flex-start;gap:8px;font-weight:700;letter-spacing:.02em;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;word-break:normal;line-height:1.25;padding-right:8px;justify-self:start;text-align:left}
.mw-item-price{display:inline-flex;align-items:center;justify-content:center;font-weight:700;text-align:center;font-variant-numeric:tabular-nums;font-size:13px;white-space:nowrap;justify-self:center;width:fit-content;min-width:110px}
.mw-item-price.positive{color:#10b981;background:rgba(16,185,129,.12);border:1px solid rgba(16,185,129,.25);padding:3px 8px;border-radius:999px}
.mw-item-price.negative{color:#ef4444;background:rgba(239,68,68,.12);border:1px solid rgba(239,68,68,.25);padding:3px 8px;border-radius:999px}
.mw-item-change-percent{display:inline-flex;align-items:center;gap:6px;padding:3px 8px;border-radius:999px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.06);justify-self:center;width:fit-content;white-space:nowrap;font-size:12px;align-self:center;text-align:center;min-width:96px}
.mw-item-change-percent.positive{color:var(--success);background:rgba(34,197,94,.12);border-color:rgba(34,197,94,.25)}
.mw-item-change-percent.negative{color:var(--danger);background:rgba(239,68,68,.12);border-color:rgba(239,68,68,.25)}
.mw-item-actions{display:none;border-top:1px solid var(--border);padding:12px}
.mw-item.expanded .mw-item-actions{display:block}
.mw-item .mw-updated{display:inline-block;color:var(--muted);font-size:11px;margin-left:8px}
.mw-quick-actions{display:flex;gap:8px;margin-top:8px}
.mw-qa-btn{appearance:none;background:var(--surface-2);border:1px solid var(--border);color:var(--text);padding:6px 10px;border-radius:8px;font-size:12px;cursor:pointer}
.mw-qa-btn:hover{background:#1a2130}
.favorite-toggle.favorite-active{color:var(--primary);border-color:var(--primary)}

/* Flag stack next to symbol */
.mw-item-flags{display:flex;align-items:center;justify-content:center;width:24px;height:18px;overflow:visible}
.mw-item-flags .logo-stock{width:18px;height:18px;display:inline-block;object-fit:contain}
.order-btn,.mw-qa-btn{cursor:pointer}
.order-btn:hover,.mw-qa-btn:hover{text-decoration:none;filter:brightness(1.05)}
.order-btn.disabled,.mw-qa-btn.disabled{opacity:.5;pointer-events:none;filter:grayscale(.4)}
.flag-stack{position:relative;width:16px;height:16px;overflow:visible}
.flag{width:16px;height:16px;border-radius:4px;box-shadow:0 1px 3px rgba(0,0,0,.25)}
.flag.flag-quote{position:absolute;left:-5px;top:3px;opacity:.9;z-index:1}
.flag.flag-base{position:absolute;left:0;top:0;z-index:2}

/* Responsive alignment without hiding info */
@media (max-width: 480px){
  .mw-list-header{grid-template-columns:24px minmax(0,1fr) 100px 88px}
  .mw-item-header{grid-template-columns:24px minmax(0,1fr) 100px 88px}
  .mw-item-change-percent{min-width:86px}
}

/* Density variant for list */
.market-watch.dense .mw-item-header{padding:6px 8px}
.market-watch.dense .mw-item{box-shadow:none}
.mw-item-symbol mark{background:rgba(46,166,255,.25);color:var(--text);border-radius:4px;padding:0 2px}

/* Price flash animation */
.price-update{transition:background-color .25s ease}
.flash-up{background:rgba(34,197,94,.08)}
.flash-down{background:rgba(239,68,68,.08)}

/* Categorías en Market Watch */
.mw-category{border-top:1px solid var(--border)}
.mw-category:first-child{border-top:none}
.mw-category-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:var(--surface-2);cursor:pointer}
.mw-category-header .left{display:flex;align-items:center;gap:8px;color:var(--text);font-weight:700}
.mw-category-header .badge{margin-left:6px;background:rgba(255,255,255,.06);border:1px solid var(--border);color:var(--muted);border-radius:999px;padding:2px 8px;font-size:11px}
.mw-category-header .chev{color:var(--muted);transition:transform .18s ease}
.mw-category.collapsed .mw-category-header .chev{transform:rotate(180deg)}
.mw-category-body{padding:8px 10px}
.mw-category-body{max-height:600px;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.15) transparent}
.mw-category-body::-webkit-scrollbar{width:8px}
.mw-category-body::-webkit-scrollbar-track{background:transparent}
.mw-category-body::-webkit-scrollbar-thumb{background:rgba(255,255,255,.08);border-radius:8px}
.mw-category-body:hover::-webkit-scrollbar-thumb{background:rgba(255,255,255,.15)}
.mw-category.collapsed .mw-category-body{display:none}

/* Chart skeleton */
.chart-area{position:relative}
.chart-header{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-weight:800;color:var(--text)}
.chart-header .tf-label{margin-left:8px;font-weight:700;color:var(--muted);border:1px solid var(--border);padding:2px 6px;border-radius:8px;font-size:12px}
.chart-header i{color:var(--primary)}
.skeleton{position:absolute;inset:8px;border-radius:10px;background:linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.08), rgba(255,255,255,.04));background-size:200% 100%;animation:skeletonShimmer 1.2s ease-in-out infinite}
.chart-skeleton{z-index:2}
@keyframes skeletonShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}

/* Panels */
.bottom-panels{margin-top:24px}
.panel-tabs{display:flex;gap:6px;padding:0 2px 10px}
.tab-btn{background:var(--surface-2);border:1px solid var(--border);color:var(--muted);padding:10px 14px;border-radius:10px;cursor:pointer;transition:all .2s;font-weight:600}
.tab-btn:hover{color:var(--text);background:#1a2130}
.tab-btn.active{background:var(--primary);color:#0b111a;border-color:transparent}
.tab-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.panels-content{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.tab-content{display:none;padding:16px}
.tab-content.active{display:block}

/* Tables inside panels */
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:10px 12px;border-bottom:1px solid var(--border)}

/* Timeframe Selector (Premium Dropdown) */
.timeframe-selector{position:relative;display:inline-block}
.timeframe-selector .tf-current{appearance:none;background:var(--surface-2);border:1px solid var(--border);color:var(--text);padding:8px 12px;border-radius:10px;display:inline-flex;align-items:center;gap:10px;cursor:pointer;transition:background .18s ease, box-shadow .18s ease}
.timeframe-selector .tf-current:hover{background:#1a2130;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.timeframe-selector .tf-current:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.timeframe-selector .tf-current .chevron{color:var(--muted);transition:transform .18s ease}
.timeframe-selector .tf-current[aria-expanded="true"] .chevron{transform:rotate(180deg)}
.timeframe-selector .tf-menu{position:absolute;top:calc(100% + 8px);left:0;min-width:220px;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow);padding:6px;display:none;opacity:0;transform:translateY(6px);pointer-events:none;transition:opacity .18s ease, transform .18s ease;z-index:40}
.timeframe-selector .tf-menu.open{display:block;opacity:1;transform:translateY(0);pointer-events:auto}
.timeframe-selector .tf-option{padding:8px 10px;border-radius:8px;color:var(--text);cursor:pointer;display:flex;align-items:center;justify-content:space-between}
.timeframe-selector .tf-option .tf-label{font-weight:700}
.timeframe-selector .tf-option .tf-desc{color:var(--muted);font-size:11px;margin-left:8px}
.timeframe-selector .tf-option:hover{background:#1a2130}
.timeframe-selector .tf-option.active{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#0b1220}
.timeframe-selector .tf-option:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
/* Herramientas premium: zoom/pan y countdown */
.chart-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 12px;margin-bottom:8px;border:1px solid rgba(255,255,255,.08);border-radius:14px;background:linear-gradient(180deg, rgba(20,24,33,.65), rgba(12,15,22,.65));backdrop-filter:blur(8px);box-shadow:0 10px 28px rgba(0,0,0,.28)}
.chart-toolbar .toolbar-group{display:flex;align-items:center;gap:12px}
.chart-toolbar .toolbar-sep{width:1px;height:22px;background:rgba(255,255,255,.08)}
.chart-tools{display:flex;align-items:center;gap:10px}
.chart-tools .tool-btn{appearance:none;background:var(--surface-2);border:1px solid var(--border);color:var(--text);padding:8px 10px;border-radius:8px;cursor:pointer;transition:background .18s ease, box-shadow .18s ease}
.chart-tools .tool-btn:hover{background:#1a2130;box-shadow:0 6px 18px rgba(0,0,0,.25)}
.chart-tools .tool-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
/* Iconos SVG dentro de los botones de herramientas */
.chart-tools .tool-btn svg{display:block;width:18px;height:18px}
.chart-tools .countdown{font-variant-numeric:tabular-nums;background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#0b1220;border-radius:8px;padding:6px 10px;font-weight:600}

/* Segmented control para temporalidades rápidas */
.tf-segmented{display:flex;align-items:center;gap:8px}
.tf-seg-btn{appearance:none;background:var(--surface-2);border:1px solid var(--border);color:var(--text);padding:6px 10px;border-radius:10px;font-size:12px;font-weight:600;cursor:pointer;transition:background .18s ease, box-shadow .18s ease}
.tf-seg-btn#load-3m-btn{font-weight:700}
.tf-seg-btn:hover{background:#1a2130}
.tf-seg-btn.active{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#0b1220;border-color:transparent;box-shadow:0 6px 18px rgba(0,0,0,.25)}
.tf-seg-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}

/* Estado activo para toggles premium */
.tool-btn.active{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#0b1220;border-color:transparent}

/* Sticky toolbar dentro del contenedor de gráfica */
.chart-toolbar{position:sticky;top:0;z-index:30}
.table thead th{color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.04em}
.table th.left{text-align:left}
.table th.center{text-align:center}
.table th.numeric{text-align:right}
.table td.center{text-align:center}
.table tbody tr:nth-child(odd){background:#121824}
.table td.numeric{text-align:right}
.pnl.numeric{font-variant-numeric:tabular-nums}

/* Badges */
.badge{display:inline-block;padding:4px 8px;border-radius:999px;font-size:11px;font-weight:700;letter-spacing:.02em}
.badge-success{background:rgba(0,212,170,.18);color:var(--success);border:1px solid rgba(0,212,170,.35)}
.badge-danger{background:rgba(255,71,87,.18);color:var(--danger);border:1px solid rgba(255,71,87,.35)}
.badge-info{background:rgba(46,166,255,.18);color:var(--primary);border:1px solid rgba(46,166,255,.35)}
.badge-warning{background:rgba(255,183,3,.18);color:var(--warning);border:1px solid rgba(255,183,3,.35)}

/* Actions */
.modify-position,.close-position,.modify-order,.cancel-order{padding:6px 10px;border-radius:8px;font-size:12px}
.pnl.profit{color:var(--success);font-weight:600}
.pnl.loss{color:var(--danger);font-weight:600}

/* Focus states for quick actions */
.mw-qa-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}

/* Modal */
.form-group{margin-bottom:14px}
.form-group label{font-weight:600;display:block;margin-bottom:6px;color:var(--text)}
.form-group input,.form-group select{width:100%;padding:10px 12px;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;color:var(--text)}
.form-group input:focus,.form-group select:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px rgba(46,166,255,.18)}
.form-row{display:flex;gap:10px}
.form-row .form-group{flex:1}
.form-group{margin-bottom:14px}
.form-group label{font-weight:600;display:block;margin-bottom:6px;color:var(--text)}
.form-group input,.form-group select{width:100%;padding:10px 12px;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;color:var(--text)}
.form-group input:focus,.form-group select:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px rgba(46,166,255,.18)}
.form-row{display:flex;gap:10px}
.form-row .form-group{flex:1}

/* Order Ticket panel */
.order-ticket { position: fixed; top: 72px; right: 0; width: 380px; max-width: 90vw; height: calc(100vh - 72px); background: var(--panel-bg, #12151a); color: var(--text-primary, #e6e6e6); border-left: 1px solid var(--border-subtle, #2a2f3a); box-shadow: -12px 0 24px rgba(0,0,0,0.35); transform: translateX(100%); transition: transform 280ms ease; z-index: 1000; }
.order-ticket.active { transform: translateX(0); }
.order-ticket-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border-subtle, #2a2f3a); }
.order-ticket-header h4 { margin: 0; font-weight: 600; }
.order-ticket-body { padding: 16px 18px; overflow-y: auto; height: calc(100% - 60px); }

.order-ticket .form-row { margin-bottom: 14px; }
.order-ticket label { display: block; font-size: 13px; color: var(--text-muted, #a9b0bd); margin-bottom: 6px; }
.order-ticket input,
.order-ticket select { width: 100%; background: var(--input-bg, #0e1116); color: var(--text-primary, #e6e6e6); border: 1px solid var(--border-subtle, #2a2f3a); border-radius: 8px; padding: 10px 12px; }
.order-ticket .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side-toggle { display: flex; gap: 8px; align-items: center; }
.side-toggle input { display: none; }
.side-toggle label { cursor: pointer; padding: 8px 10px; border-radius: 8px; }
.side-toggle input:checked + label { filter: brightness(1.1); }

.order-summary { margin: 16px 0; padding: 12px; background: var(--panel-subtle, #181c23); border: 1px solid var(--border-subtle, #2a2f3a); border-radius: 8px; }
.order-summary .summary-item { display: flex; justify-content: space-between; margin: 6px 0; }

.order-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }
.order-actions .btn { padding: 10px 12px; border-radius: 8px; }

/* Header button for theme toggle */
.header-btn#themeToggle { display: inline-flex; align-items: center; justify-content: center; }
#themeIcon { transition: transform 200ms ease, color 200ms ease; }
body.theme-dark #themeIcon { color: #f0c419; }
body.theme-light #themeIcon { color: #2a2f3a; }

/* Responsive: narrow screens */
@media (max-width: 992px) {
  .order-ticket { top: 60px; height: calc(100vh - 60px); width: 100%; max-width: 100%; }
}

/* Price update animations */
@keyframes flashNeutral {
  0% { background-color: rgba(46, 166, 255, 0.18); }
  100% { background-color: transparent; }
}
@keyframes flashUp {
  0% { background-color: rgba(0, 212, 170, 0.15); }
  100% { background-color: transparent; }
}
@keyframes flashDown {
  0% { background-color: rgba(255, 71, 87, 0.15); }
  100% { background-color: transparent; }
}

.market-watch td.price-update { animation: flashNeutral 0.6s ease; }
.market-watch td.flash-up { animation: flashUp 0.8s ease; }
.market-watch td.flash-down { animation: flashDown 0.8s ease; }

.change.positive, .change-percent.positive { color: var(--success); }
.change.negative, .change-percent.negative { color: var(--danger); }
.favorite-toggle.favorite-active i{animation:starPop .35s ease}
@keyframes starPop{0%{transform:scale(1)}40%{transform:scale(1.3) rotate(12deg)}100%{transform:scale(1)}}

#favFilterToggle.active{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#0b1220;border:none}

@media (max-width: 768px){
  .mw-qa-btn{font-size:0;padding:8px 10px}
  .mw-qa-btn i{font-size:16px}
  .mw-quick-actions{right:6px}
}
.order-advanced-panel{display:none;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:10px;margin-top:6px}
.order-advanced-panel.open{display:block}
.order-card .order-advanced-panel.open{position:static;box-shadow:0 10px 30px rgba(0,0,0,.35)}
.order-advanced-panel{position:relative}
.order-advanced-panel .adv-close{position:absolute;top:8px;right:8px;appearance:none;background:var(--surface-3);border:1px solid var(--border);color:var(--muted);width:28px;height:28px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 6px rgba(0,0,0,.25);transition:all .15s ease}
.order-advanced-panel .adv-close:hover{background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#0b1220;border-color:transparent}
.order-advanced-panel .adv-close:focus{outline:2px solid var(--primary);outline-offset:2px}
.order-advanced-panel .adv-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.order-advanced-panel .adv-label{font-weight:700;color:var(--text)}
.order-advanced-panel .adv-volume-controls{display:flex;align-items:center;justify-content:center;gap:8px;margin-bottom:8px}
.order-advanced-panel .adv-volume{font-weight:700}
.order-advanced-panel .toggle{display:flex;align-items:center;gap:8px;margin:8px 0;color:var(--muted)}
.order-advanced-panel .inline-controls{display:flex;align-items:center;gap:8px;margin:6px 0}
.order-advanced-panel .inline-controls .btn{padding:6px 10px;height:28px;font-size:14px;border-radius:8px}
.order-advanced-panel .inline-controls.active{background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));border:1px solid var(--border);border-radius:12px;padding:10px;height:64px;justify-content:space-between}
.order-advanced-panel .inline-controls.active .btn{height:36px;width:36px;border-radius:10px;display:flex;align-items:center;justify-content:center}
.order-advanced-panel .inline-controls .calc-input{text-align:center;font-weight:800;}
.order-advanced-panel .inline-controls .calc-input.display-main{font-size:18px;min-width:140px}
.order-advanced-panel .vol-controls{margin-bottom:12px}
.order-advanced-panel .vol-input-wrap{display:flex;flex-direction:column;align-items:center}
.order-advanced-panel .percent-bar{position:relative;height:14px;background:rgba(255,255,255,.08);border:1px solid var(--border);border-radius:999px;overflow:hidden;margin-top:6px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.06)}
.order-advanced-panel .percent-fill{position:absolute;left:0;top:0;height:100%;background:linear-gradient(135deg,#2ea6ff,#00c2ff);border-right:1px solid rgba(255,255,255,.2);display:flex;align-items:center}
.order-advanced-panel .percent-bar .percent-label{position:absolute;left:8px;top:50%;transform:translateY(-50%);font-size:10px;color:#fff;font-weight:700}
.order-advanced-panel .toggle{margin:12px 0}
.order-advanced-panel .inline-controls{margin:10px 0}
.order-advanced-panel .entry-controls{margin:12px 0}
.order-advanced-panel .inline-controls .unit-under{flex-basis:100%;text-align:center;font-size:11px;color:var(--muted);margin-top:2px}
.order-advanced-panel .unit-under.vol-approx{font-size:11px;margin-top:2px;line-height:1.2;text-align:center;font-weight:700}
.order-advanced-panel .summary{margin-top:14px;border-top:1px solid var(--border);padding-top:10px}
.order-advanced-panel .summary .row{display:flex;justify-content:space-between;padding:4px 0}

/* Selector de modo de cálculo (Precio/Valor/%/Puntos) */
.calc-mode{appearance:none;background:transparent;border:1px solid var(--border);color:var(--muted);padding:6px 10px;border-radius:8px;display:inline-flex;align-items:center;gap:8px;cursor:pointer}
.calc-mode:hover{color:var(--text)}
.calc-select{appearance:none;background:var(--surface-3);border:1px solid var(--border);color:var(--text);padding:6px 10px;border-radius:8px}
.calc-select{position:relative;z-index:5}
.calc-select{min-width:130px}
.calc-select-wrap{position:relative;display:inline-flex;align-items:center}
.calc-select-wrap .chev{position:absolute;right:8px;color:var(--muted);pointer-events:none}
.calc-input{appearance:none;background:var(--surface-3);border:1px solid var(--border);color:var(--text);padding:6px 10px;border-radius:8px;min-width:88px}
.metric-row{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:12px}
.metric-row .pos{color:#10b981}
.metric-row .neg{color:#ef4444}

/* Toggle switch styling */
.switch{position:relative;display:inline-block;width:42px;height:22px;vertical-align:middle}
.switch input{opacity:0;width:0;height:0}
.switch .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:var(--surface-3);border:1px solid var(--border);transition:.2s;border-radius:999px}
.switch .slider:before{content:"";position:absolute;height:18px;width:18px;left:2px;bottom:2px;background:#cbd5e1;transition:.2s;border-radius:999px}
.switch input:checked + .slider{background:linear-gradient(135deg,#2ea6ff,#00c2ff);border-color:transparent}
.switch input:checked + .slider:before{transform:translateX(20px);background:#0b1220}
.toggle-label{margin-left:8px;font-weight:700;color:var(--text)}
.adv-exec{display:flex;align-items:center;justify-content:space-between;margin-top:12px}
.adv-exec .exec-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px;border-radius:12px;font-weight:800;line-height:1.1;border:1px solid var(--border);height:56px;width:48%;cursor:pointer}
.adv-exec .exec-btn.sell{background:linear-gradient(135deg,rgba(255,71,87,.25),rgba(255,71,87,.15));color:#fee}
.adv-exec .exec-btn.buy{background:linear-gradient(135deg,rgba(0,212,170,.25),rgba(0,212,170,.15));color:#eafff7}
.adv-exec .exec-btn .exec-price{display:block;margin-top:6px;font-weight:700}
.hidden{display:none !important}
.account-summary .value.profit.neg{color:var(--danger)}
.account-summary .value.profit.pos{color:var(--success)}
.ml-caret{appearance:none;background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:6px;padding:2px 6px;margin-left:6px;cursor:pointer}
.ml-caret:hover{color:var(--text);border-color:var(--primary)}
.

.method-tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:12px}
.method-tiles{overflow:hidden}
.method-tile{display:grid;grid-template-rows: 1fr;align-items:center;justify-items:center;background:var(--surface-2);border:1px solid var(--border);border-radius:12px;padding:10px;cursor:pointer;user-select:none;width:100%;height:100px;text-align:center}
.method-tile i{font-size:22px;color:var(--text)}
.tile-logo{display:flex;align-items:center;justify-content:center;width:100%}
.method-tile .method-logo{max-width:100px;max-height:40px;object-fit:contain;display:inline-block}
.method-title{display:none}
.chip-row{height:20px;display:flex;align-items:center;gap:6px}
.method-tile span{display:none}
.method-tile .method-meta{margin-top:2px;font-size:12px;color:var(--muted)}
.method-pagination{display:flex;align-items:center;justify-content:center;gap:10px;margin-top:8px}
.method-pagination .page-indicator{font-weight:700;color:var(--muted)}
.method-pagination .btn{padding:6px 10px}
.method-input{display:none}
.method-tile.selected{border-color:#2ea6ff;box-shadow:0 0 0 2px rgba(46,166,255,.35);background:linear-gradient(180deg, rgba(20,24,33,.65), rgba(12,15,22,.65))}
.mw-item-price{transition:none;color:inherit}
.mw-item-price.positive,.mw-item-price.negative{color:inherit}
.mw-item-price.flash-up,.mw-item-price.flash-down{animation:none}
.inline-error{font-size:12px;color:var(--danger)}
.btn[disabled]{opacity:.6;cursor:not-allowed}
.txn-recent{margin-top:8px}
.txn-recent .txn-title{font-weight:700;margin-bottom:6px}
.txn-list{display:grid;gap:6px}
.txn-item{display:flex;justify-content:space-between;align-items:center;background:var(--surface-2);border:1px solid var(--border);border-radius:8px;padding:6px 10px;font-size:13px}
#depositModal .modal-content{background:linear-gradient(180deg,#111827,#0b1323);border:1px solid rgba(255,255,255,.08);box-shadow:0 12px 32px rgba(0,0,0,.45);will-change:transform,opacity;backface-visibility:hidden;overscroll-behavior:contain}
#depositModal .modal-header{user-select:none}
#depositModal .modal-header .close-modal{pointer-events:auto}
#depositModal .modal-header{background:linear-gradient(135deg,#1f2937,#111827);border-bottom:1px solid rgba(255,255,255,.06)}
#depositModal .modal-header h3{font-weight:800;letter-spacing:.02em}
#depositModal .balance-info{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:12px}
#depositModal .balance-item{background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);border-radius:12px;padding:10px}
#depositModal .balance-item .label{color:var(--muted);font-size:12px}
#depositModal .balance-item .value{font-weight:800}
#depositModal .deposit-form .form-group{margin-bottom:10px}
#depositModal .method-tiles{gap:14px}
#depositModal .method-group{margin-bottom:14px}
#depositModal .method-group-title{display:none}
#depositModal #depositMethods{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px;justify-content:center;justify-items:center;align-items:center;padding:4px;overflow:visible}
@media (max-width: 1280px){#depositModal #depositMethods{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}}
@media (max-width: 1024px){#depositModal #depositMethods{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}}
@media (max-width: 640px){#depositModal #depositMethods{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}}
#depositModal .method-tile{min-height:100px}
#depositModal .form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:8px}
#depositModal .form-text{color:var(--muted);font-size:12px}
.country-tiles{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;align-items:center}
.country-chip{display:flex;align-items:center;gap:8px;justify-content:flex-start;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);border-radius:10px;padding:8px 12px;cursor:pointer;line-height:1}
.country-chip.selected{border-color:#2ea6ff;box-shadow:0 0 0 2px rgba(46,166,255,.35)}
.country-chip input{display:none}
.country-chip span{font-weight:700;font-size:13px;line-height:16px}
.country-chip .flag-svg{width:22px;height:16px;display:inline-block;vertical-align:middle;border-radius:3px;object-fit:contain}
.method-chip{display:grid;place-items:center;background:linear-gradient(180deg,#ffffff,#f6f8fb);border:1px solid #e5e7eb;border-radius:12px;width:160px;height:102px;cursor:pointer;line-height:1;box-shadow:0 6px 14px rgba(0,0,0,.06);transition:box-shadow .15s ease, transform .12s ease, border-color .12s ease;padding:10px;overflow:hidden}
.method-chip:hover{transform:translateY(-1px);box-shadow:0 10px 18px rgba(0,0,0,.10);border-color:#d1d5db}
.method-chip.selected{border:3px solid #2ea6ff;box-shadow:0 0 0 2px rgba(46,166,255,.25)}
.method-chip input{display:none}
.method-chip .method-logo{max-width:108px;max-height:36px;display:block;object-fit:contain;margin:0;justify-self:center;align-self:center}
.chip-contents{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
.method-name{display:none}
.method-chip{width:auto}
@media (max-width: 640px){.method-chip .method-logo{width:48px;height:16px}.method-name{font-size:11px}}
