@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Variáveis de Cor para fácil customização */
:root {
    --bg-dark: #05070d;
    --bg-medium: #0d111a;
    --bg-light: #141925;
    --border-color: rgba(255, 255, 255, 0.05);
    --card-bg: rgba(13, 17, 26, 0.95);
    --card-border: rgba(255, 255, 255, 0.07);
    --text-primary: #f5f7fb;
    --text-secondary: #8f99b2;
    --text-muted: #9ca3af;
    --accent-blue: #38bdf8;
    --accent-green: #22c55e;
    --accent-red: #f87171;
    --accent-yellow: #facc15;
    --gradient-start: #0b1120;
    --gradient-end: #05070d;
    --premium-border: rgba(255, 255, 255, 0.08);
    --premium-shadow: 0 25px 80px rgba(0, 0, 0, 0.55);
    --success-strong: #22c55e;
    --danger-strong: #f87171;
    --info-strong: #38bdf8;
    --warning-strong: #facc15;
}

/* Reset Básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Suporte para navegação por toque */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Remover barras de rolagem visuais */
*::-webkit-scrollbar {
    display: none;
}
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 40%),
        radial-gradient(circle at 20% 20%, rgba(34, 197, 94, 0.08), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(248, 113, 113, 0.07), transparent 30%),
        var(--bg-dark);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
    min-height: 100vh;
    padding-top: 64px; /* reduz espaço e aproxima cards do cabeçalho */
    padding-bottom: 0;
}

/* Header */
.header-bar {
    background-color: var(--bg-medium);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 150;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
}

.header-row--main {
    width: 100%;
}

.header-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
    justify-content: space-between;
    flex: 1 1 auto;
}

@media (max-width: 1100px) {
    .header-row,
    .header-group {
        flex-wrap: nowrap;
        justify-content: space-between;
    }
}

@media (max-width: 767px) {
    /* Empilhar conteúdo no mobile: info de conexão/conta/saldo abaixo de logo/usuário */
    .header-row {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
    }
    .header-group {
        flex-direction: row;
        align-items: center;
        width: 100%;
        gap: 10px;
        flex-wrap: wrap; /* permite quebrar linha */
        justify-content: space-between;
    }
    .header-left-inline {
        order: 1;
        width: 100%;
        justify-content: flex-start;
    }
    .header-right-inline {
        order: 2;
        width: 100%;
        justify-content: flex-start; /* alinhar próximo à logo/usuário */
        gap: 10px;
        margin-left: 0; /* sobrescreve margin-left:auto */
        margin-top: 6px;
        flex-wrap: wrap;
    }
    .status-indicator span,
    .header-account-chip,
    .header-balance-chip {
        font-size: 12px;
    }
    .header-account-chip,
    .header-balance-chip {
        padding: 4px 8px;
        border-radius: 10px;
    }
}

.logo-title {
    font-size: 1.5em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text { display: inline-flex; }
@media (max-width: 767px) { .logo-text { display: none; } }

.header-logo-img {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.header-user {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    color: #e2e8f0;
    font-weight: 600;
}

.header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(15,23,42,0.8);
}

.header-username {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.header-logout {
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.header-logout:hover {
    background: rgba(255,255,255,0.08);
    color: #e5e7eb;
}

.header-actions-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

/* Grupos laterais do cabeçalho */
.header-left-inline,
.header-right-inline {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.header-right-inline { margin-left: auto; }

.status-indicator { display: inline-flex; align-items: center; gap: 8px; }

/* Indicador de conexão (fallback de estilo) */
.status-indicator .status-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444; /* vermelho desconectado */
}
.status-indicator .status-circle.connected { background: #22c55e; }
.status-indicator .status-circle.disconnected { background: #ef4444; }

.header-account-chip {
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.panel-action-btn,
.admin-control-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, #0c1424, #111b32);
    color: #e2e8f0;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    transition: all 0.2s ease;
}

.panel-action-btn i,
.admin-control-btn i {
    color: #8dd1ff;
}

.panel-action-btn.full-width {
    width: 100%;
    justify-content: center;
}

.panel-action-btn.small {
    padding: 6px 10px;
    font-size: 12px;
}

.panel-action-btn:hover,
.admin-control-btn:hover {
    background: #111827;
    border-color: rgba(255,255,255,0.14);
}

.panel-action-btn.danger {
    background: linear-gradient(135deg, #4c1018, #7a1c29);
    border-color: rgba(255,96,96,0.35);
}

.panel-action-btn.success {
    background: linear-gradient(135deg, #0d5f4e, #11a96c);
    border-color: rgba(17,169,108,0.4);
}

.panel-action-btn.neutral {
    background: linear-gradient(135deg, #1f2937, #0f172a);
}

.panel-action-btn.danger i {
    color: #ffc0c0;
}

.panel-action-btn.success i {
    color: #d4ffe9;
}

.panel-action-btn.neutral i {
    color: #a0b4ff;
}

.spa-modal {
    position: fixed;
    inset: 0;
    background: rgba(7, 13, 27, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    z-index: 2200;
}

.spa-modal.active {
    display: flex;
}

.spa-modal-card {
    width: min(1200px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    background: linear-gradient(135deg, #050912, #0b1324);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
}

.spa-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.spa-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e2e8f0;
}

.spa-modal-body {
    padding: 0;
}

.spa-close-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    color: #e2e8f0;
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.spa-close-btn:hover {
    background: rgba(255,255,255,0.1);
}

.spa-loading {
    padding: 30px;
    text-align: center;
    color: #cbd5e1;
}

.header-menu {
    position: relative;
}

.header-menu-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: #e2e8f0;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.header-menu-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}

.header-menu-list {
    position: absolute;
    right: 0;
    top: 110%;
    min-width: 220px;
    background: rgba(10,12,20,0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.45);
    padding: 10px 0;
    display: none;
    z-index: 150;
}

.header-menu-list.open {
    display: block;
}

.header-menu-list a,
.header-menu-list button {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: #e2e8f0;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
}

.header-menu-list a:hover,
.header-menu-list button:hover {
    background: rgba(255,255,255,0.05);
}

.header-menu-subtext {
    display: block;
    color: #a5b4c0;
    font-size: 0.9em;
    margin-top: 2px;
}

.connection-status-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.status-circle.disconnected { background-color: var(--accent-red); }
.status-circle.connected { background-color: var(--accent-green); }

.header-balance-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(34, 197, 94, 0.14));
    color: #e5f9ff;
    font-weight: 700;
    letter-spacing: 0.1px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    transition: transform 0.2s ease, box-shadow 0.35s ease;
}

.header-balance-chip i {
    color: #a5f3fc;
}

.header-balance-chip.flash {
    animation: headerBalancePulse 1.4s ease;
}

@keyframes headerBalancePulse {
    0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.38); transform: translateY(0); }
    35% { box-shadow: 0 0 0 8px rgba(56, 189, 248, 0.0); transform: translateY(-1px); }
    70% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.28); transform: translateY(0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Layout Principal */
.main-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
    padding: 32px 12px 88px; /* menor afastamento do topo e espaço para nav fixa no mobile */
    gap: 20px;
}

@media (min-width: 768px) {
    .main-container {
        flex-direction: row;
        padding: 40px 24px 32px; /* topo mais próximo do cabeçalho em telas maiores */
        gap: 24px;
    }
}

/* Barra de Navegação - Mobile First */
.nav-bar {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-medium);
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    gap: 6px;
    width: 100%;
    max-width: 230px;
    position: static;
    box-shadow: none;
}

@media (min-width: 768px) {
    .nav-bar {
        align-self: flex-start;
        position: sticky;
        top: 64px; /* acompanha nova altura útil do cabeçalho */
    }
}

@media (max-width: 767px) {
    .nav-bar {
        flex-direction: row;
        border-radius: 18px 18px 0 0;
        border: none;
        border-top: 1px solid var(--border-color);
        position: fixed;
        bottom: 0;
        left: 12px;
        right: 12px;
        padding: 10px;
        gap: 8px;
        justify-content: space-around;
        box-shadow: 0 -6px 24px rgba(0,0,0,0.35);
        max-width: none;
        width: auto;
        background: rgba(13,17,26,0.95);
        backdrop-filter: blur(6px);
        z-index: 180;
    }
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
    flex-shrink: 0;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .nav-btn {
        flex-direction: row;
        text-align: left;
        font-size: 1em;
        padding: 12px 15px;
        gap: 12px;
        min-width: auto;
        flex-shrink: 1;
    }
}
.nav-btn i {
    font-size: 18px;
    text-align: center;
}

@media (min-width: 768px) {
    .nav-btn i {
        width: 20px;
        font-size: 16px;
    }
}
.nav-btn:hover {
    background-color: var(--bg-light);
    color: var(--text-primary);
}
.nav-btn.active {
    background-color: var(--accent-blue);
    color: white;
}

/* Área de Conteúdo */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

@media (min-width: 768px) {
    .content-area {
        padding: 0;
    }
}
.content-page {
    display: none;
}
.content-page.active {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 768px) {
    .content-page.active {
        display: grid;
        gap: 20px;
    }
}
.card,
.analysis-card,
.trading-control-card,
.trading-config-card,
.asset-selection-card,
.status-card,
.summary-card,
.manual-trade-panel {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--premium-shadow);
    backdrop-filter: blur(18px);
}

.status-alert {
    display: none;
    align-items: flex-start;
    gap: 12px;
    margin: 12px 0 18px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--accent-red);
    background: rgba(220, 53, 69, 0.08);
    color: var(--accent-red);
    font-weight: 500;
}

.status-alert.visible {
    display: flex;
}

.status-alert i {
    font-size: 1.25rem;
    margin-top: 2px;
}

.status-alert strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

@media (min-width: 768px) {
    .card {
        padding: 25px;
        display: flex;
        flex-direction: column;
    }
    #trading-page .trading-grid .card {
        min-height: 400px;
    }
}
.card-title {
    font-size: 1.2em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

/* Grids de Layout - Mobile First (Stack) */
.config-grid, 
.trading-grid, 
.performance-grid,
.status-grid,
.finance-grid,
.finance-summary-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.projection-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .config-grid, 
    .performance-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    #trading-page .trading-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        max-width: 1200px;
        margin: 0 auto;
        width: 100%;
    }
    .status-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    .finance-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        align-items: flex-end;
        gap: 20px;
    }
    .finance-summary-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1200px) {
    .status-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .finance-grid,
    .finance-summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Forms e Inputs - Mobile Optimized */
.form-group {
    margin-bottom: 18px;
}

@media (min-width: 768px) {
    .form-group {
        margin-bottom: 15px;
    }
}
.form-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}
input[type="email"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

@media (min-width: 768px) {
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select {
        padding: 12px;
        font-size: 1em;
        border-radius: 5px;
    }
}
input:focus, select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Botões - Mobile Optimized */
button {
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 16px;
    min-height: 48px;
    touch-action: manipulation;
    user-select: none;
}

@media (min-width: 768px) {
    button {
        padding: 12px 20px;
        font-size: 1em;
        border-radius: 5px;
        min-height: auto;
    }
}
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

@media (min-width: 768px) {
    .action-buttons {
        flex-direction: row;
        gap: 10px;
    }
}
.btn-primary,
.btn-secondary,
.btn-success,
.btn-reset-limits,
.btn-start-robot,
.btn-reset-limits {
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    background: linear-gradient(120deg, #60a5fa, #2563eb);
    color: #fff;
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow:0 20px 35px rgba(37,99,235,0.45); }

.btn-secondary {
    background: linear-gradient(120deg, #f97316, #ea580c);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-success {
    background: linear-gradient(120deg, #22c55e, #15803d);
    color: #fff;
}

.btn-reset-limits,
.btn-secondary:hover,
.btn-success:hover,
.btn-primary.full-width:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
}
.btn-success {
    background: linear-gradient(120deg, #22c55e, #15803d);
    color: #fff;
    border: none;
}
.btn-success.connected {
    background: linear-gradient(120deg, #f87171, #dc2626);
}
.btn-danger {
    background: linear-gradient(120deg, #f87171, #dc2626);
    color: #fff;
    border: none;
}
.btn-secondary {
    background: linear-gradient(120deg, #fdba74, #ea580c);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.asset-mode-buttons { 
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.asset-btn {
    background-color: var(--bg-dark);
    color: var(--text-secondary);
    flex: 1;
    min-width: 100px;
}

@media (min-width: 768px) {
    .asset-btn {
        flex: none;
        margin-right: 5px;
    }
}
.asset-btn.active {
    background-color: var(--accent-blue);
    color: white;
}

.backtest-period-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

#backtest-period {
    width: 100%;
}

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-dark);
    outline: none;
    border-radius: 5px;
    border: 1px solid var(--border-color);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    cursor: pointer;
    border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    cursor: pointer;
    border-radius: 50%;
}
input[type="range"]::-moz-range-track {
    background: var(--bg-dark);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}


/* Toggle Switches */
.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.switch input { display: none; }
.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
  transition: .4s;
  border-radius: 34px;
}
.slider-round:before {
  position: absolute;
  content: "";
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background-color: var(--text-secondary);
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider-round {
  background-color: var(--accent-green);
}
input:checked + .slider-round:before {
  transform: translateX(22px);
  background-color: white;
}

/* Estilos Específicos das Páginas */
/* Status */
.status-card {
    display: flex;
    align-items: center;
    gap: 15px;
}
.status-card-icon {
    font-size: 2em;
    color: var(--text-secondary);
}
.status-card-info {
    display: flex;
    flex-direction: column;
}
.status-card-title {
    color: var(--text-secondary);
    font-size: 0.9em;
}
.status-card-value {
    font-size: 1.5em;
    font-weight: 600;
}
.status-card-hint {
    margin-top: 4px;
    font-size: 0.9em;
    color: var(--text-secondary);
    opacity: 0.85;
}
.details-grid p { margin: 10px 0; }
.details-grid p strong { color: var(--text-secondary); }
.strategy-tag { background-color: #28a74520; color: var(--accent-green); padding: 3px 8px; border-radius: 5px; font-weight: 500; }
.timeframe-tag { background-color: #007bff20; color: var(--accent-blue); padding: 3px 8px; border-radius: 5px; font-weight: 500;}

/* Trading */
/* Novo layout de botões do robô */
.robot-control-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-start-robot {
    flex: 2;
    padding: 15px;
    font-size: 1.2em;
    background-color: var(--accent-green);
    color: white;
}

.btn-reset-limits {
    flex: 1;
    padding: 15px;
    font-size: 0.95em;
    background-color: #ffc107;
    color: #212529;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-reset-limits:hover {
    background-color: #e0a800;
    transform: translateY(-1px);
}

.btn-reset-limits:active {
    transform: translateY(0);
}

/* Mobile - botões empilhados verticalmente */
@media (max-width: 768px) {
    .robot-control-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-start-robot,
    .btn-reset-limits {
        flex: none;
        width: 100%;
    }
}
.btn-start-robot.stop { background-color: var(--accent-red); }
.trading-info {
    display: flex;
    justify-content: space-around;
    text-align: center;
}
.trading-info span { color: var(--text-secondary); display: block; }
.trading-info strong { font-size: 1.4em; }
.current-config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.current-config-grid p {
    background: var(--bg-dark);
    padding: 10px;
    border-radius: 5px;
}
.current-config-grid strong { color: var(--text-secondary); }

/* Performance */
.stats-list p {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.stats-list p:last-child { border-bottom: none; }
.win { color: var(--accent-green); font-weight: 600; }
.loss { color: var(--accent-red); font-weight: 600; }

.session-day-summary {
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-day-summary .session-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.session-day-summary .session-pill .wins { color: var(--accent-green); font-weight: 600; }
.session-day-summary .session-pill .losses { color: var(--accent-red); font-weight: 600; }

/* Tabelas - Mobile Responsive */
.table-container, .history-container-scroll {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .table-container, .history-container-scroll {
        max-height: 400px;
    }
}

/* Filtros de Histórico */
.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 8px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-medium);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--bg-light);
    border-color: var(--accent-blue);
}

.filter-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.goal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.goal-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.goal-item strong {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.goal-item small {
    color: var(--text-secondary);
    font-size: 12px;
}

.finance-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

@media (max-width: 768px) {
    .finance-summary-grid {
        grid-template-columns: 1fr;
    }
}

.risk-profile-card .risk-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.risk-profile-card .risk-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.risk-profile-card .risk-table-wrapper {
    overflow-x: auto;
}

.risk-profile-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.risk-profile-card th,
.risk-profile-card td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
}

.risk-profile-card tbody tr:last-child td {
    border-bottom: none;
}

.risk-profile-card tbody tr td:nth-child(2),
.risk-profile-card tbody tr td:nth-child(3),
.risk-profile-card tbody tr td:nth-child(4) {
    font-weight: 600;
}

.risk-profile-card tr.active {
    background: rgba(14, 116, 144, 0.12);
}

.risk-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.risk-option input[type="radio"] {
    accent-color: var(--accent-blue);
    margin-top: 4px;
}

.risk-option-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.risk-option-copy span {
    font-size: 12px;
    color: var(--text-secondary);
}

.risk-card-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Calendário Customizado */
.custom-date-picker {
    margin-bottom: 15px;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.date-inputs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.date-inputs label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.date-inputs input[type="date"] {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-medium);
    color: var(--text-primary);
    font-size: 13px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
}

/* Mobile responsivo para filtros */
@media (max-width: 768px) {
    .history-filters {
        justify-content: center;
    }
    
    .filter-btn {
        flex: 1;
        min-width: 80px;
        text-align: center;
    }
    
    .date-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-inputs label {
        justify-content: space-between;
    }
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
th, td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    white-space: nowrap;
}

@media (min-width: 768px) {
    th, td {
        padding: 12px;
        font-size: inherit;
    }
}
th {
    background-color: var(--bg-dark);
    color: var(--text-secondary);
    font-weight: 600;
}

/* Finanças */
.summary-card {
    text-align: center;
}
.summary-title {
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
}
.summary-value {
    font-size: 2em;
    font-weight: 700;
}

/* Ativos */
#ativos-checkbox-container {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-dark);
    border-radius: 5px;
}
.asset-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}
.asset-item:last-child { border-bottom: none; }
.asset-item.available label {
    color: var(--accent-green);
}

/* Popup - Mobile Responsive */
.popup {
    position: fixed; 
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex; 
    justify-content: center; 
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

/* Popup centralizado quando em operação */
.popup.centered {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 10000 !important;
    width: 100vw !important;
    height: 100vh !important;
}

/* Estado em operação com logo no fundo */
.popup-state.in-trade-state {
    position: relative;
}

.popup-state.in-trade-state::before {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    background-image: url('logora.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.15;
    z-index: 0;
}

/* Iframe Bull-ex Integrado */
.bull-ex-iframe {
    width: 100%;
    height: 70vh;
    min-height: 600px;
    border: none;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: var(--bg-medium);
}

@media (max-width: 767px) {
    .bull-ex-iframe {
        height: 70vh;
        min-height: 620px;
        margin-bottom: 15px;
        border-radius: 6px;
    }
}

@media (min-width: 1200px) {
    .bull-ex-iframe {
        height: 75vh;
        min-height: 700px;
    }
}

/* ===== MOBILE OPTIMIZATIONS ===== */

/* Melhora performance em dispositivos móveis */
@media (max-width: 767px) {
    body {
        font-size: 15px;
    }
    
    .logo-title {
        font-size: 1.3em;
    }
    
    .card-title {
        font-size: 1.1em;
    }
    
    /* Melhor espaçamento vertical */
    .main-container {
        padding-bottom: 80px; /* Espaço para navegação inferior */
    }
    
    /* Otimização de touch targets */
    .status-card {
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 10px;
    }
    
    /* Scroll suave para listas */
    .assets-grid,
    .table-container,
    .history-container-scroll {
        scroll-behavior: smooth;
    }
    
    /* Melhor visibilidade de seleções */
    .nav-btn.active {
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    }
    
    /* Otimização de forms */
    .form-group label {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    /* Range sliders maiores */
    input[type="range"] {
        height: 12px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    /* Toggles maiores */
    .switch {
        width: 54px;
        height: 32px;
    }
    
    .slider-round:before {
        height: 24px;
        width: 24px;
        left: 3px;
        bottom: 3px;
    }
    
    input:checked + .slider-round:before {
        transform: translateX(22px);
    }
}

/* Tablets e dispositivos médios */
@media (min-width: 768px) and (max-width: 1023px) {
    .main-container {
        padding: 15px;
        gap: 15px;
    }
    
    .nav-bar {
        width: 180px;
    }
    
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Landscape mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .nav-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-medium);
        border-top: 2px solid var(--border-color);
        padding: 8px 10px;
    }
    
    .main-container {
        padding-bottom: 70px;
    }
    
    .header-bar {
        padding: 10px 15px;
        min-height: 50px;
    }
    
    .logo-title {
        font-size: 1.2em;
    }
}
.popup-content {
    background: var(--bg-medium);
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border-color);
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .popup-content {
        max-width: 450px;
        border-radius: 10px;
    }
}
.popup-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.close-btn { background: none; color: var(--text-primary); font-size: 24px; padding: 0; }
.popup-footer { display: flex; justify-content: space-around; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border-color); }

/* Notificações e toasts premium */
.toast-stack,
#notification-container {
    position: fixed;
    top: 85px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 13000;
    pointer-events: none;
}

@media (max-width: 768px) {
    .toast-stack,
    #notification-container {
        left: 16px;
        right: 16px;
        top: 70px;
    }
}

.ra-toast,
.toast-notification {
    background: linear-gradient(135deg, rgba(21, 23, 28, 0.96), rgba(17, 19, 24, 0.96));
    border: 1px solid var(--premium-border);
    border-left: 3px solid transparent;
    color: var(--text-primary);
    padding: 16px 18px;
    border-radius: 14px;
    box-shadow: var(--premium-shadow);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    opacity: 0;
    transform: translate3d(26px, 10px, 0) scale(0.95);
    animation: toast-enter 0.35s forwards;
    pointer-events: auto;
    font-size: 14px;
}

.ra-toast.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.ra-toast.closing {
    animation: toast-exit 0.25s forwards;
}

.ra-toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.ra-toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ra-toast-title {
    font-size: 15px;
    font-weight: 600;
}

.ra-toast-message {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.ra-toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.ra-toast-close:hover {
    color: #fff;
}

.ra-toast--success,
.toast-notification.success {
    border-left-color: var(--success-strong);
}

.ra-toast--error,
.toast-notification.error {
    border-left-color: var(--danger-strong);
}

.ra-toast--warning,
.toast-notification.warning {
    border-left-color: var(--warning-strong);
}

.ra-toast--info,
.toast-notification.info {
    border-left-color: var(--info-strong);
}

@keyframes toast-enter {
    0% {
        opacity: 0;
        transform: translate3d(36px, 15px, 0) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes toast-exit {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate3d(40px, 0, 0) scale(0.9);
    }
}

/* Operation popups */
.operation-popup-root {
    position: fixed;
    inset: 0;
    z-index: 12500;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 24px;
}

@media (max-width: 768px) {
    .operation-popup-root {
        padding: 16px;
    }
}

.operation-popup-card {
    width: min(420px, 100%);
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 55%),
        linear-gradient(135deg, rgba(21, 23, 28, 0.95), rgba(15, 17, 22, 0.96));
    border-radius: 18px;
    border: 1px solid var(--premium-border);
    box-shadow: var(--premium-shadow);
    padding: 22px 24px;
    color: var(--text-primary);
    opacity: 0;
    transform: translate3d(0, 40px, 0) scale(0.94);
    animation: popup-enter 0.4s forwards;
    pointer-events: auto;
    backdrop-filter: blur(14px);
}

.operation-popup-card.mode-win .operation-popup-title {
    color: var(--success-strong);
}

.operation-popup-card.mode-win .operation-popup-icon {
    background: rgba(34, 197, 94, 0.12);
}

.operation-popup-card.mode-loss .operation-popup-title {
    color: var(--danger-strong);
}

.operation-popup-card.mode-loss .operation-popup-icon {
    background: rgba(248, 113, 113, 0.12);
}

.operation-popup-card.mode-new_entry .operation-popup-icon {
    background: rgba(56, 189, 248, 0.12);
}

.operation-popup-card.closing {
    animation: popup-exit 0.3s forwards;
}

.operation-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.operation-popup-headings {
    flex: 1;
}

.operation-popup-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.operation-popup-close:hover {
    color: #fff;
}

.operation-popup-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.operation-popup-title {
    font-size: 18px;
    font-weight: 600;
}

.operation-popup-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.operation-popup-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.operation-popup-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-muted);
}

.operation-popup-row strong {
    color: var(--text-primary);
}

.expiration-countdown {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 6px;
}

.operation-popup-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 4px;
}

.operation-popup-stat {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--premium-border);
    border-radius: 12px;
    padding: 12px;
}

.operation-popup-stat span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.operation-popup-stat strong {
    font-size: 16px;
}

.operation-popup-daystats {
    margin-top: 8px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--premium-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.operation-popup-daystats .daystat-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-primary);
}

.operation-popup-daystats .daystat-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    align-items: center;
}

.operation-popup-daystats .daystat-values {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.operation-popup-daystats .daystat-values .separator {
    color: var(--text-muted);
}

.operation-popup-daystats .wins {
    color: var(--accent-green);
}

.operation-popup-daystats .losses {
    color: var(--accent-red);
}

.operation-popup-status-line {
    margin-top: 8px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    font-size: 13px;
    color: var(--text-muted);
}

.operation-popup-footer {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.operation-popup-footer button {
    flex: 1;
    min-width: 140px;
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 12px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.operation-popup-footer .btn-primary {
    background: linear-gradient(120deg, #2563eb, #1d4ed8);
    border-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.operation-popup-footer .btn-ghost {
    background: transparent;
    border-color: var(--premium-border);
    color: var(--text-secondary);
}

.direction-chip {
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

.direction-call {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-strong);
}

.direction-put {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger-strong);
}

.result-value {
    font-size: 18px;
    font-weight: 600;
}

.result-value.positive {
    color: var(--success-strong);
}

.result-value.negative {
    color: var(--danger-strong);
}

.operation-popup-limit {
    margin-top: 8px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.4);
    font-size: 13px;
    color: var(--danger-strong);
}

@keyframes popup-enter {
    0% {
        opacity: 0;
        transform: translate3d(0, 40px, 0) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes popup-exit {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate3d(0, 40px, 0) scale(0.9);
    }
}

/* Config popups com visual premium */
.modern-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 14000;
    padding: 24px;
}

.modern-popup-simple {
    width: min(640px, 95%);
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 60%),
        linear-gradient(135deg, rgba(21, 23, 28, 0.95), rgba(11, 13, 18, 0.96));
    border-radius: 20px;
    border: 1px solid var(--premium-border);
    box-shadow: var(--premium-shadow);
    padding: 32px 32px 28px;
    position: relative;
    color: var(--text-primary);
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

.modern-popup-simple h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.modern-popup-simple p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.success-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    margin: 0 auto 18px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: var(--success-strong);
}

.success-icon.theme-success {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--success-strong);
}

.success-icon.theme-info {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.3);
    color: var(--info-strong);
}

.success-icon.theme-warning {
    background: rgba(250, 204, 21, 0.15);
    border-color: rgba(250, 204, 21, 0.3);
    color: var(--warning-strong);
}

.success-icon.theme-error {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--danger-strong);
}

.popup-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--premium-border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popup-close:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.popup-description {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.popup-message {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.popup-message strong {
    color: var(--text-primary);
}

.popup-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.popup-summary-list li {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--premium-border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.popup-summary-list .summary-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.popup-summary-list .summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.config-summary-section {
    margin-bottom: 18px;
}

.config-summary-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.config-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.popup-summary-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--premium-border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.popup-summary-card .summary-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.popup-summary-card .summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.account-display {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.account-type-btn,
.account-balance {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--premium-border);
    border-radius: 12px;
    padding: 10px 16px;
}

.account-type-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.account-type-row select {
    flex: 1;
}

.btn-success.full-width {
    width: 100%;
}

.btn-success.mini {
    padding: 6px 10px;
    border-radius: 10px;
    white-space: nowrap;
    font-size: 12px;
}

.btn-danger.mini {
    padding: 6px 10px;
    border-radius: 10px;
    white-space: nowrap;
    font-size: 12px;
}

.action-cell {
    display: flex;
    gap: 6px;
}

.advanced-actions {
    margin-top: 16px;
}

.advanced-actions .btn-primary.full-width {
    width: 100%;
    border-radius: 14px;
}

.popup-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.popup-actions .btn-primary,
.popup-actions .btn-ghost {
    flex: 1;
    border-radius: 12px;
    border: 1px solid transparent;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popup-actions .btn-primary {
    background: linear-gradient(120deg, #2563eb, #1d4ed8);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.08);
}

.popup-actions .btn-ghost {
    background: transparent;
    border-color: var(--premium-border);
    color: var(--text-secondary);
}

/* Seleção de Ativos OTC - Interface Moderna */
.auto-assets-info, .manual-assets-info, .market-open-assets-info {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.selection-mode-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selection-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}

.selection-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: var(--bg-medium);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-small:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.selected-count, .selected-count-market-open {
    color: var(--accent-green);
    font-weight: 500;
    font-size: 13px;
}

/* Grid de Ativos - Mobile First */
.assets-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .assets-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (min-width: 1200px) {
    .assets-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

.assets-grid.market-open-mode {
    grid-template-columns: 1fr;
    gap: 8px;
}

.asset-item {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
}

.asset-item:hover {
    border-color: var(--accent-blue);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.asset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.asset-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.asset-status {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.asset-status.open {
    background: rgba(40, 167, 69, 0.2);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.asset-status.closed {
    background: rgba(220, 53, 69, 0.2);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.asset-status-horizontal.closing {
    background: rgba(255, 193, 7, 0.2);
    color: var(--accent-yellow);
    border: 1px solid var(--accent-yellow);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
}

.asset-status-horizontal.open {
    background: rgba(40, 167, 69, 0.2);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
}

.asset-status-horizontal.closed {
    background: rgba(220, 53, 69, 0.2);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
}

/* Payouts Display */
.payouts-display {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.payout-item {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid;
    transition: all 0.3s ease;
}

.payout-item.available {
    background: rgba(40, 167, 69, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.payout-item.unavailable {
    background: rgba(160, 160, 160, 0.15);
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.payout-item.current-timeframe {
    background: rgba(0, 123, 255, 0.25);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
}

/* Seleção Manual - Checkboxes */
.asset-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    width: 100%;
}

.asset-checkbox {
    margin: 0;
    opacity: 0;
    position: absolute;
    z-index: -1; /* Garantir que fica completamente escondido */
    visibility: hidden; /* Dupla proteção contra aparecer */
}

.checkmark {
    width: 18px;
    height: 18px;
    background: var(--bg-dark); /* Usar fundo escuro em vez de medium */
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.3s ease;
    /* Garantir que não apareça branco */
    box-shadow: none;
    outline: none;
}

.asset-checkbox:checked + .checkmark {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.asset-checkbox:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 12px;
    top: -1px;
    left: 3px;
}

.asset-content {
    flex: 1;
}

/* Estados de Loading e Info */
.loading-assets {
    text-align: center;
    padding: 20px;
    color: var(--accent-blue);
    font-style: italic;
}

.info-message {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.info-message i {
    margin-right: 8px;
    color: var(--accent-blue);
}

.no-assets, .error-message {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.no-assets {
    background: var(--bg-light);
    color: var(--text-secondary);
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    color: var(--accent-red);
    border-color: var(--accent-red);
}

/* Popup Moderno de Conexão com Logo RA Trading */
.connection-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    background: transparent;
    z-index: 9000;
    backdrop-filter: none;
    animation: fadeIn 0.4s ease-out;
    pointer-events: none;
}

.connection-popup-content {
    background: linear-gradient(135deg, var(--bg-medium) 0%, var(--bg-light) 100%);
    border-radius: 20px;
    width: 450px;
    max-width: 90vw;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--accent-green);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 20px rgba(40, 167, 69, 0.3);
    animation: slideInFromTop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInFromTop {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.connection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 0;
    position: relative;
}

.success-indicator {
    color: var(--accent-green);
    font-size: 24px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.connection-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.connection-close-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    color: var(--accent-red);
    transform: rotate(90deg);
}

.connection-body {
    position: relative;
    padding: 20px 25px 30px;
}

.logo-background {
    position: absolute;
    top: -10px;
    right: -20px;
    width: 120px;
    height: 120px;
    opacity: 0.1;
    z-index: 0;
    animation: logoFloat 6s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(1deg); }
    66% { transform: translateY(5px) rotate(-1deg); }
}

.ra-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1.2) contrast(1.1);
}

.connection-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.connection-title {
    color: var(--accent-green);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.connection-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 25px;
}

.account-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: none;
}

.account-type-badge {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-weight: 700;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    animation: shimmer 2s ease-in-out infinite alternate;
}

.account-type-badge.demo {
    background: linear-gradient(135deg, var(--accent-blue), #4dabf7);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

@keyframes shimmer {
    from { box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3); }
    to { box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5); }
}

.balance-display {
    text-align: right;
}

.balance-amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, var(--accent-green), #51cf66);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.connection-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.detail-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.detail-item i {
    color: var(--accent-blue);
    width: 16px;
    text-align: center;
}

.detail-item span {
    color: var(--text-secondary);
    font-size: 13px;
}

.detail-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Estilos para campos de Martingale e Soros */
.martingale-settings, .soros-settings {
    margin-left: 20px;
    padding: 15px;
    background-color: var(--bg-dark);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 20px; /* Aumentado para evitar sobreposição */
    margin-bottom: 25px; /* Espaço extra para o botão Soros */
    transition: all 0.3s ease;
}

.martingale-settings.show, .soros-settings.show {
    display: block !important;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

/* Formato compacto para ativos */
.asset-item.compact-format {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.asset-item.compact-format:hover {
    background-color: var(--bg-medium);
    border-color: var(--accent-blue);
    transform: translateX(2px);
}

/* === ESTILOS MODERNOS PARA MODO MANUAL === */
.asset-item.manual-asset.modern-format {
    background: #2a2a2a;
    border: 1px solid #404040;
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 0;
    transition: all 0.2s ease;
}

.asset-item.manual-asset.modern-format:hover {
    border-color: #007bff;
    background: #2f2f2f;
}

.asset-modern-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asset-modern-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.asset-icon-modern {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.asset-icon-modern.binary {
    background: #007bff;
}

.asset-icon-modern.digital {
    background: #28a745;
}

.asset-icon-modern.opcoes {
    background: #ffc107;
    color: #000;
}

.asset-name-modern {
    color: #ffffff;
    font-weight: 500;
    font-size: 14px;
    flex: 1;
}

.asset-status-modern {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.asset-status-modern.open {
    background: #28a745;
    color: white;
}

.asset-status-modern.closed {
    background: #dc3545;
    color: white;
}

.timeframes-modern {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.timeframe-badge.modern {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.timeframe-badge.modern.available {
    background: #007bff;
    color: white;
    border: 1px solid #0056b3;
}

.timeframe-badge.modern.unavailable {
    background: #444;
    color: #999;
    border: 1px solid #555;
}

.asset-compact-info {
    display: flex;
    align-items: center;
    width: 100%;
}

.asset-compact-text {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
}

/* Ajustes para o modo manual compacto */
.manual-asset.compact-format .asset-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    cursor: pointer;
}

.manual-asset.compact-format .checkmark {
    min-width: 16px;
    height: 16px;
}

.manual-asset.compact-format .asset-content {
    flex: 1;
}

/* === NOVO LAYOUT HORIZONTAL PARA MODO MANUAL === */
.asset-item.manual-asset.horizontal-layout,
.asset-item.market-open-asset.horizontal-layout {
    background: #2a2a2a;
    border: 1px solid #404040;
    border-radius: 8px;
    margin-bottom: 6px;
    padding: 0;
    transition: all 0.2s ease;
}

.asset-item.manual-asset.horizontal-layout:hover,
.asset-item.market-open-asset.horizontal-layout:hover {
    border-color: #007bff;
    background: #2f2f2f;
    transform: translateX(2px);
}

.asset-horizontal-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    width: 100%;
}

.asset-horizontal-label .checkmark {
    width: 16px;
    height: 16px;
    background: var(--bg-medium);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.asset-horizontal-label .asset-checkbox:checked + .checkmark,
.asset-horizontal-label .asset-checkbox-market-open:checked + .checkmark {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.asset-horizontal-label .asset-checkbox:checked + .checkmark::after,
.asset-horizontal-label .asset-checkbox-market-open:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 11px;
    top: -1px;
    left: 2px;
}

.asset-icon-horizontal {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 11px;
    flex-shrink: 0;
}

.asset-icon-horizontal.binary {
    background: #007bff;
}

.asset-name-horizontal {
    color: #ffffff;
    font-weight: 500;
    font-size: 13px;
    min-width: 120px;
    flex-shrink: 0;
}

.asset-status-horizontal {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-right: 12px;
}

.asset-status-horizontal.open {
    background: #28a745;
    color: white;
}

.asset-status-horizontal.closed {
    background: #dc3545;
    color: white;
}

.timeframes-horizontal {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.timeframe-badge.horizontal {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    min-width: 50px;
    text-align: center;
}

.timeframe-badge.horizontal.high-payout.available {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-color: #1e7e34;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.timeframe-badge.horizontal.medium-payout.available {
    background: linear-gradient(135deg, #17a2b8, #20c997);
    color: white;
    border-color: #138496;
    box-shadow: 0 2px 4px rgba(23, 162, 184, 0.3);
}

.timeframe-badge.horizontal.low-payout.available {
    background: linear-gradient(135deg, #6c757d, #868e96);
    color: white;
    border-color: #5a6268;
}

.timeframe-badge.horizontal.unavailable {
    background: #444;
    color: #999;
    border-color: #555;
}

.timeframe-badge.horizontal:hover.available {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}

/* Ajuste de prioridade para .timeframe-badge */
.timeframe-badge.available {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.timeframe-badge.high-payout {
    background: var(--accent-green);
    color: white;
    border-color: var(--accent-green);
}

/* Se necessário, aumente a especificidade para garantir prioridade */
.content-area .timeframe-badge.available {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.content-area .timeframe-badge.high-payout {
    background: var(--accent-green);
    color: white;
    border-color: var(--accent-green);
}

/* Responsividade */
@media (max-width: 1200px) {
    .status-grid, .finance-summary-grid { grid-template-columns: 1fr 1fr; }
    .finance-grid { grid-template-columns: 1fr; }
    
    /* Responsividade tablet APENAS para a aba Trading */
    #trading-page .trading-grid { 
        grid-template-columns: 1fr 1fr; 
        max-width: 100%;
        margin: 0 10px;
    }
}
@media (max-width: 768px) {
    .main-container { flex-direction: column; }
    .nav-bar { width: 100%; flex-direction: row; justify-content: space-around; }
    .config-grid, .performance-grid, .status-grid, .finance-summary-grid { grid-template-columns: 1fr; }
    
    /* Layout mobile específico APENAS para a aba Trading */
    #trading-page .trading-grid { 
        grid-template-columns: 1fr; 
        max-width: 100%;
        margin: 0;
        padding: 0 10px;
    }
    
    .connection-popup-content {
        width: 350px;
        margin: 20px;
    }
    
    .connection-title {
        font-size: 20px;
    }
    
    .balance-amount {
        font-size: 24px;
    }
    
    .account-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .logo-background {
        width: 80px;
        height: 80px;
        top: 10px;
        right: 10px;
    }
}

/* === PRIORIDADE VISUAL PARA TIMEFRAME-FIX.CSS === */
/* Adicione aqui as regras específicas do timeframe-fix.css, se necessário. Exemplo: */
/*
.timeframe-badge {
    font-weight: bold !important;
    border-width: 2px !important;
    /* Outras regras do timeframe-fix.css */
/*
}
*/

body.popup-open {
    overflow: hidden;
}


.log-card {
    min-height: 400px;
}

.log-content {
    background: #0f111a;
    color: #d5f6ff;
    font-family: "Fira Code", "SFMono-Regular", Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    padding: 1rem;
    border-radius: 12px;
    height: 420px;
    overflow-y: auto;
    white-space: pre-wrap;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}

/* ===== Indicadores de Pré-Entrada ===== */
.preentry-section,
#preentry-section-status {
    background: linear-gradient(135deg, rgba(21, 23, 28, 0.92), rgba(10, 12, 17, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 14px;
    margin-top: 10px;
}

.preentry-section-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preentry-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.preentry-header .badge.test {
    margin-left: auto;
    background: rgba(56, 189, 248, 0.18);
    color: #a5f3fc;
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.preentry-content {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    gap: 12px;
}

.preentry-timer {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.04em;
}

.mini-progress-container {
    position: relative;
    height: 8px;
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.mini-progress-bar {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.55), rgba(34, 197, 94, 0.6));
    transition: width 0.5s ease;
}

.preentry-hint {
    color: var(--text-muted);
    font-size: 12px;
}


/* Histórico detalhado */
.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    font-size: 0.9rem;
}

.history-table thead {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.history-table th,
.history-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.history-table tbody tr.win {
    background-color: rgba(40, 167, 69, 0.08);
}

.history-table tbody tr.loss {
    background-color: rgba(220, 53, 69, 0.05);
}

.history-table tbody tr.win .history-result,
.history-table tbody tr.win .history-profit {
    color: var(--accent-green);
    font-weight: 600;
}

.history-table tbody tr.loss .history-result,
.history-table tbody tr.loss .history-profit {
    color: var(--accent-red);
    font-weight: 600;
}

.history-table .history-amount,
.history-table .history-profit {
    font-variant-numeric: tabular-nums;
}

.trade-strategy {
    color: var(--accent-blue);
    font-weight: 600;
}

.trade-direction {
    font-weight: 600;
    color: var(--text-primary);
}

.trade-direction.direction-call {
    color: var(--accent-green);
}

.trade-direction.direction-put {
    color: var(--accent-red);
}

.trade-result {
    font-weight: 600;
    color: var(--text-primary);
}

.trade-result.result-win {
    color: var(--accent-green);
}

.trade-result.result-loss {
    color: var(--accent-red);
}

.trade-profit {
    color: var(--text-primary);
    font-weight: 600;
}

.trade-profit.positive {
    color: var(--accent-green);
}

.trade-profit.negative {
    color: var(--accent-red);
}

/* Config summary card for Trading tab */
.trading-config-card {
    background: linear-gradient(135deg, rgba(21, 23, 28, 0.92), rgba(10, 12, 17, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--premium-shadow);
}

.trading-config-card .config-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.trading-config-card .config-summary-section h4 {
    color: var(--text-secondary);
}

/* Sessões de trading */
.trading-sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.session-config {
    background: linear-gradient(135deg, rgba(21, 23, 28, 0.9), rgba(12, 14, 19, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--premium-shadow);
}

.session-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.session-title {
    font-size: 16px;
    font-weight: 600;
}

.session-subtitle {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.session-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.session-toggle input {
    display: none;
}

.toggle-pill {
    width: 38px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    position: relative;
    transition: background 0.2s ease;
}

.toggle-pill::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.session-toggle input:checked + .toggle-pill {
    background: var(--accent-green);
}

.session-toggle input:checked + .toggle-pill::after {
    transform: translateX(20px);
}

.session-body {
    display: grid;
    gap: 12px;
}

.session-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 14px;
}

.session-card-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.session-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.form-group.compact label {
    font-size: 12px;
    color: var(--text-secondary);
}

.form-group.compact input {
    margin-top: 4px;
}
.trading-control-card {
    background: linear-gradient(135deg, rgba(21, 23, 28, 0.9), rgba(10, 12, 17, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    box-shadow: var(--premium-shadow);
}

.robot-control-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.robot-control-buttons button {
    flex: 1;
    min-width: 160px;
    border-radius: 14px;
    border: none;
    padding: 12px 16px;
    font-weight: 600;
}

.btn-start-robot {
    background: linear-gradient(120deg, #22c55e, #15803d);
    color: #fff;
}

.btn-reset-limits {
    background: linear-gradient(120deg, #facc15, #d97706);
    color: #111;
}

.manual-trade-section {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 18px;
}

.manual-trade-section .section-title {
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.manual-trade-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.manual-trade-panel .full-width {
    grid-column: 1 / -1;
}
/* Página de autenticação */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 40%),
        radial-gradient(circle at 20% 20%, rgba(34, 197, 94, 0.08), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(248, 113, 113, 0.07), transparent 30%),
        var(--bg-dark);
}

.auth-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 28px;
    width: min(1100px, 95vw);
    padding: 40px;
}

.auth-brand {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--premium-shadow);
}

.auth-logo-circle {
    width: 160px;
    height: 160px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo {
    max-width: 140px;
    max-height: 140px;
    object-fit: contain;
}

.auth-brand h1 {
    font-size: 26px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.auth-brand p {
    color: var(--text-secondary);
}

.auth-card {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 26px;
    box-shadow: var(--premium-shadow);
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.auth-tabs button {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tabs button.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: transparent;
}

.auth-message {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-message.error { color: var(--accent-red); }
.auth-message.success { color: var(--accent-green); }

.auth-footer {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 768px) {
    .auth-container {
        padding: 20px 12px;
    }
}
