:root {
    --bg-1: #07111f;
    --bg-2: #0c1728;
    --bg-3: #132238;
    --panel: rgba(14, 24, 40, 0.88);
    --panel-strong: rgba(18, 31, 50, 0.96);
    --border: rgba(255, 255, 255, 0.08);
    --text: #ebf2ff;
    --muted: #8da0bf;
    --primary: #3b82f6;
    --primary-2: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --neutral: #64748b;
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.30);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.12), transparent 24%),
        radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.08), transparent 20%),
        linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 45%, #081223 100%);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 255px;
    background: linear-gradient(180deg, rgba(3, 10, 21, 0.96), rgba(5, 14, 26, 0.96));
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    gap: 14px;
    align-items: center;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    color: #fff;
    font-size: 20px;
    box-shadow: var(--shadow);
}

.brand h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.brand small {
    color: var(--muted);
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
    flex: 1;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #d8e4ff;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 14px;
    transition: 0.2s ease;
    border: 1px solid transparent;
}

.menu-link:hover {
    background: rgba(59, 130, 246, 0.10);
    border-color: rgba(59, 130, 246, 0.12);
    color: #fff;
}

.menu-link.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.24), rgba(59, 130, 246, 0.08));
    border-color: rgba(59, 130, 246, 0.18);
    color: #fff;
}

.sidebar-footer {
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.mini-status {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot-green {
    background: var(--success);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
}

/* MAIN */
.main-content {
    flex: 1;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.symbol-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.symbol-line h2 {
    margin: 0;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.symbol-badge {
    font-size: 11px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: #8ec5ff;
    border: 1px solid rgba(59, 130, 246, 0.18);
    font-weight: 700;
}

.subline {
    color: var(--muted);
    margin-top: 6px;
    font-size: 14px;
}

.topbar-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.quote-box {
    min-width: 180px;
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 14px 16px;
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.quote-box.compact {
    min-width: 120px;
}

.quote-box span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.quote-box strong {
    font-size: 24px;
    color: #fff;
}

/* GLASS CARD */
.glass-card {
    background: linear-gradient(180deg, rgba(18, 29, 47, 0.90), rgba(13, 22, 36, 0.88));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.kpi-card {
    padding: 20px;
}

.kpi-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    margin-bottom: 14px;
    font-size: 14px;
}

.kpi-top i {
    font-size: 18px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    word-break: break-word;
}

.kpi-sub {
    color: var(--muted);
    font-size: 13px;
}

.success-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(16, 31, 50, 0.95));
}

/* MAIN GRID */
.main-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
}

.left-col,
.right-col {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.section-card {
    padding: 22px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.section-head h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.section-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.section-head-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.12);
    color: #8ec5ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid rgba(59, 130, 246, 0.14);
}

/* FORM */
.form-label {
    color: #cdd9ee;
    font-size: 13px;
    margin-bottom: 8px;
}

.custom-input {
    height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(8, 15, 27, 0.92);
    color: #fff;
}

.custom-input:focus {
    color: #fff;
    background: rgba(8, 15, 27, 1);
    border-color: rgba(59,130,246,0.45);
    box-shadow: 0 0 0 0.2rem rgba(59,130,246,0.14);
}

.custom-btn {
    height: 48px;
    border: none;
    border-radius: 14px;
    padding: 0 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    font-weight: 700;
}

.custom-btn:hover {
    background: linear-gradient(135deg, #2f76eb, #1d4ed8);
}

.ghost-btn {
    height: 48px;
    border-radius: 14px;
    padding: 0 18px;
}

.action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.preview-box {
    min-height: 48px;
    border-radius: 14px;
    border: 1px dashed rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.02);
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: var(--muted);
    font-size: 13px;
}

/* PROTEÇÕES */
.protection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.protection-item {
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.protection-item span {
    color: #dfe9ff;
    font-size: 14px;
}

.status-badge {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-active {
    background: rgba(59,130,246,0.18);
    color: #8ec5ff;
    border: 1px solid rgba(59,130,246,0.22);
}

.status-ok {
    background: rgba(16,185,129,0.18);
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,0.22);
}

.status-warn {
    background: rgba(245,158,11,0.18);
    color: #fcd34d;
    border: 1px solid rgba(245,158,11,0.22);
}

.status-danger {
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.22);
}

.status-neutral {
    background: rgba(100,116,139,0.18);
    color: #cbd5e1;
    border: 1px solid rgba(100,116,139,0.22);
}

/* TABLE */
.custom-table {
    color: #e7efff;
    margin-top: 4px;
}

.custom-table thead th {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
}

.custom-table tbody td {
    border-color: rgba(255,255,255,0.05);
    background: transparent !important;
    color: #e7efff !important;
    font-size: 14px;
    font-weight: 500;
}

.custom-table tbody td strong,
.custom-table tbody td span,
.custom-table tbody td small {
    color: inherit !important;
}

.custom-table tbody tr:hover td {
    background: rgba(255,255,255,0.03) !important;
}

.table-empty {
    text-align: center;
    color: var(--muted) !important;
    padding: 22px !important;
}

/* INFO LIST */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
}

.info-row span {
    color: var(--muted);
    font-size: 13px;
}

.info-row strong {
    color: #fff;
    font-size: 14px;
    text-align: right;
}

/* LOGS */
.log-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-item {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.03);
}

.log-item strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.log-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.log-item.muted {
    color: var(--muted);
}

/* QUICK */
.quick-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quick-mini {
    border-radius: 14px;
    padding: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
}

.quick-mini span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.quick-mini strong {
    display: block;
    font-size: 15px;
    color: #fff;
}

/* RESPONSIVO */
@media (max-width: 1350px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1100px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .menu {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .topbar {
        flex-direction: column;
    }

    .symbol-line h2 {
        font-size: 30px;
    }
}

@media (max-width: 700px) {
    .main-content {
        padding: 18px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .protection-grid,
    .quick-boxes {
        grid-template-columns: 1fr;
    }

    .action-row {
        flex-direction: column;
    }

    .custom-btn,
    .ghost-btn {
        width: 100%;
    }
}

/* V6 - INTELIGÊNCIA */
.intel-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 14px;
}

.intel-item {
border: 1px solid rgba(255,255,255,0.06);
background: rgba(255,255,255,0.02);
border-radius: 16px;
padding: 16px;
display: flex;
flex-direction: column;
gap: 8px;
}

.intel-item span {
color: var(--muted);
font-size: 13px;
}

.intel-item strong {
color: #fff;
font-size: 22px;
font-weight: 800;
line-height: 1.1;
}

.intel-item small {
color: var(--muted);
font-size: 12px;
}

.intel-wide {
grid-column: span 2;
}

.text-profit {
color: #6ee7b7 !important;
}

.text-loss {
color: #fca5a5 !important;
}

@media (max-width: 1100px) {
.intel-grid {
grid-template-columns: repeat(2, 1fr);
}

.intel-wide {
grid-column: span 2;
}
}

@media (max-width: 700px) {
.intel-grid {
grid-template-columns: 1fr;
}

.intel-wide {
grid-column: span 1;
}
}
.signal-box {
display: flex;
flex-direction: column;
justify-content: center;
}

.signal-box small {
margin-top: 6px;
color: var(--muted);
font-size: 12px;
}

.intel-item strong.status-badge,
.signal-box .status-badge {
display: inline-flex;
align-items: center;
justify-content: center;
width: fit-content;
min-width: 72px;
}

/* AUTO TRADE */
.auto-card {
background: linear-gradient(180deg, rgba(18, 29, 47, 0.94), rgba(13, 22, 36, 0.90));
}

.auto-grid {
display: flex;
flex-direction: column;
gap: 16px;
}

.auto-main {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
padding: 16px 18px;
border-radius: 18px;
border: 1px solid rgba(59,130,246,0.14);
background: rgba(59,130,246,0.05);
}

.auto-label {
font-size: 20px;
font-weight: 800;
color: #fff;
}

.auto-sub {
margin-top: 6px;
color: var(--muted);
font-size: 13px;
}

.auto-stats {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
}

.auto-stat-box {
padding: 14px;
border-radius: 16px;
background: rgba(255,255,255,0.03);
border: 1px solid rgba(255,255,255,0.06);
}

.auto-stat-box span {
display: block;
font-size: 12px;
color: var(--muted);
margin-bottom: 6px;
}

.auto-stat-box strong {
display: block;
font-size: 14px;
color: #fff;
word-break: break-word;
}

.switch-toggle {
position: relative;
display: inline-block;
width: 76px;
height: 42px;
flex: 0 0 auto;
}

.switch-toggle input {
opacity: 0;
width: 0;
height: 0;
}

.switch-slider {
position: absolute;
cursor: pointer;
inset: 0;
background: rgba(100,116,139,0.40);
border: 1px solid rgba(255,255,255,0.10);
transition: .25s ease;
border-radius: 999px;
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.switch-slider:before {
content: "";
position: absolute;
height: 30px;
width: 30px;
left: 5px;
top: 5px;
background: #fff;
transition: .25s ease;
border-radius: 50%;
box-shadow: 0 4px 14px rgba(0,0,0,0.28);
}

.switch-toggle input:checked + .switch-slider {
background: linear-gradient(135deg, rgba(16,185,129,0.85), rgba(59,130,246,0.85));
border-color: rgba(16,185,129,0.28);
}

.switch-toggle input:checked + .switch-slider:before {
transform: translateX(34px);
}

.switch-toggle input:disabled + .switch-slider {
cursor: wait;
opacity: 0.7;
}

@media (max-width: 1100px) {
.auto-stats {
grid-template-columns: repeat(2, 1fr);
}
}

@media (max-width: 700px) {
.auto-main {
flex-direction: column;
align-items: flex-start;
}

.auto-stats {
grid-template-columns: 1fr;
}
}
#ordersTable td:first-child {
    color: #cbd5e1 !important;
}

#ordersTable td:nth-child(5),
#ordersTable td:nth-child(6) {
    color: #ffffff !important;
    font-variant-numeric: tabular-nums;
}

/* CYCLE */
.cycle-strip {
    margin-bottom: 22px;
}

.cycle-card {
    padding: 22px;
}

.cycle-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.cycle-head h3 {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 800;
}

.cycle-head p {
    margin: 0;
    color: var(--muted);
}

.cycle-badge-wrap {
    display: flex;
    align-items: center;
}

.cycle-steps {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.cycle-step {
    padding: 12px 10px;
    border-radius: 14px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--muted);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
}

.cycle-step.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(59,130,246,0.24), rgba(16,185,129,0.18));
    border-color: rgba(59,130,246,0.30);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.12) inset;
}

.cycle-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.cycle-meta-box {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
}

.cycle-meta-box span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.cycle-meta-box strong {
    font-size: 16px;
    color: #fff;
}

/* DOMINANT */
.dominant-card {
    position: relative;
    overflow: hidden;
}

.dominant-card::after {
    content: '';
    position: absolute;
    inset: auto -60px -60px auto;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(59,130,246,0.20), transparent 65%);
    pointer-events: none;
}

.dominant-card.is-ok {
    border-color: rgba(16,185,129,0.32);
}

.dominant-card.is-warn {
    border-color: rgba(245,158,11,0.32);
}

.dominant-card.is-danger {
    border-color: rgba(239,68,68,0.32);
}

.dominant-engine-name {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 8px;
}

.dominant-engine-reason {
    color: var(--muted);
    margin-bottom: 16px;
}

.dominant-meta {
    display: grid;
    gap: 10px;
}

/* TIMELINE */
.timeline-list {
    display: grid;
    gap: 12px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.timeline-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.timeline-item strong {
    display: block;
    margin-bottom: 4px;
}

.timeline-item small {
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
}

.timeline-dot.ok { background: var(--success); box-shadow: 0 0 12px rgba(16,185,129,0.6); }
.timeline-dot.warn { background: var(--warning); box-shadow: 0 0 12px rgba(245,158,11,0.5); }
.timeline-dot.danger { background: var(--danger); box-shadow: 0 0 12px rgba(239,68,68,0.5); }
.timeline-dot.neutral { background: var(--neutral); }

@media (max-width: 1100px) {
    .cycle-steps {
        grid-template-columns: repeat(3, 1fr);
    }

    .cycle-meta-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .cycle-steps,
    .cycle-meta-grid {
        grid-template-columns: 1fr;
    }

    .cycle-head {
        flex-direction: column;
    }
}
.watchlist {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.watch-item {
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.08);
    transition: 0.2s;
}

.watch-item:hover {
    background: rgba(59,130,246,0.15);
}

.watch-item.active {
    background: rgba(59,130,246,0.3);
}
.log-summary {
    margin-top: 8px;
    font-size: 12px;
    color: #93c5fd;
    line-height: 1.45;
}

.log-details {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.log-details span {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: #dbeafe;
    border: 1px solid rgba(255,255,255,0.06);
}
.protection-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.protection-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    min-height: 138px;
    padding: 16px 16px 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
}

.protection-item > div:first-child {
    flex: 1;
    min-width: 0;
}

.protection-item > div:first-child > span:first-child {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #f3f4f6;
}

.protection-meta {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.55;
}

.protection-meta span {
    color: #f8fafc;
    font-weight: 600;
}

.protection-meta br {
    content: "";
    display: block;
    margin-bottom: 2px;
}

.status-badge {
    flex-shrink: 0;
    align-self: center;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.status-neutral {
    color: #d1d5db;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.status-live,
.status-active {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.28);
}

.status-ok {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.16);
    border: 1px solid rgba(34, 197, 94, 0.26);
}

.status-warn {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.status-danger {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.28);
}

@media (max-width: 980px) {
    .protection-grid {
        grid-template-columns: 1fr;
    }
}