:root {
    --bg-main: #0b0e14;
    --bg-card: #151b26;
    --bg-card-hover: #1c2433;
    --border-color: #242d3d;
    --text-primary: #f0f3f8;
    --text-secondary: #8c9ba5;
    --text-muted: #5e6c79;
    --accent-gold: #f5ac00;
    --accent-gold-bg: rgba(245, 172, 0, 0.12);
    --color-buy: #0ecb81;
    --color-buy-bg: rgba(14, 203, 129, 0.15);
    --color-sell: #f6465d;
    --color-sell-bg: rgba(246, 70, 93, 0.15);
    --color-warning: #ffaa00;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* HEADER */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-size: 28px;
}

.logo-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.logo-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

/* TICKER BOX */
.ticker-box {
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 18px;
}

.ticker-item {
    display: flex;
    flex-direction: column;
}

.ticker-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.ticker-val {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
}

.price-bid { color: var(--color-buy); }
.price-ask { color: var(--color-sell); }

/* HEADER ACTIONS */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-buy);
    background: var(--color-buy-bg);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(14, 203, 129, 0.3);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--color-buy);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--color-buy);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

/* BUTTONS */
.btn {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
}

.btn-warning {
    background: var(--color-warning);
    color: #000;
}
.btn-warning:hover {
    background: #e69900;
}

.btn-danger {
    background: var(--color-sell);
    color: #fff;
}
.btn-danger:hover {
    background: #e03248;
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--color-sell);
    color: var(--color-sell);
}
.btn-outline-danger:hover {
    background: var(--color-sell);
    color: #fff;
}

.btn-outline-warning {
    background: transparent;
    border: 1px solid var(--color-warning);
    color: var(--color-warning);
}
.btn-outline-warning:hover {
    background: var(--color-warning);
    color: #111;
}

/* KPI GRID */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    transition: border-color 0.2s ease;
}

.kpi-card:hover {
    border-color: #38455d;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-val {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

.highlight-card {
    border-color: var(--accent-gold);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(245, 172, 0, 0.05) 100%);
}

.bot-status-text {
    color: var(--color-buy);
}

/* QUICK TRADING SECTION */
.quick-trade-section {
    margin-bottom: 20px;
}

.quick-trade-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.qt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.qt-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-gold);
}

.qt-note {
    font-size: 12px;
    color: var(--text-secondary);
}

.qt-form {
    display: grid;
    grid-template-columns: 140px 220px 180px 180px 1fr;
    gap: 16px;
    align-items: end;
}

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

.qt-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qt-input-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qt-input {
    background: #0b0e14;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.qt-input:focus {
    border-color: var(--accent-gold);
}

.lot-stepper {
    display: flex;
    align-items: center;
}

.btn-step {
    background: #1f2737;
    border: 1px solid var(--border-color);
    color: #fff;
    width: 38px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-step:hover {
    background: #2b364c;
}
.btn-step:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-step:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.lot-input {
    width: 80px;
    text-align: center;
    border-radius: 0 !important;
    border-left: none;
    border-right: none;
}

.lot-presets {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 10.5px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.preset-btn:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.qt-actions {
    display: flex;
    gap: 12px;
}

.btn-trade-buy {
    flex: 1;
    background: linear-gradient(135deg, #0ecb81 0%, #0ba366 100%);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.btn-trade-buy:hover {
    background: #0ecb81;
    box-shadow: 0 4px 15px rgba(14, 203, 129, 0.4);
}

.btn-trade-sell {
    flex: 1;
    background: linear-gradient(135deg, #f6465d 0%, #c92c41 100%);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.btn-trade-sell:hover {
    background: #f6465d;
    box-shadow: 0 4px 15px rgba(246, 70, 93, 0.4);
}

.btn-trade-title {
    font-size: 14px;
    font-weight: 700;
}

.btn-trade-price {
    font-family: var(--font-mono);
    font-size: 11.5px;
    opacity: 0.9;
}

/* MAIN LAYOUT */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

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

/* CARDS & TABS */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent-gold);
    background: var(--accent-gold-bg);
}

.badge {
    background: #242d3d;
    color: #fff;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-family: var(--font-mono);
}

.card-body {
    padding: 18px 20px;
}

.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}

/* TABLES */
.table-responsive {
    overflow-x: auto;
}

.trade-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.trade-table th {
    color: var(--text-secondary);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
}

.trade-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-family: var(--font-mono);
}

.trade-table tr:hover td {
    background: var(--bg-card-hover);
}

.badge-buy {
    color: var(--color-buy);
    background: var(--color-buy-bg);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
}

.badge-sell {
    color: var(--color-sell);
    background: var(--color-sell-bg);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
}

.profit-positive { color: var(--color-buy); font-weight: 700; }
.profit-negative { color: var(--color-sell); font-weight: 700; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 35px 0 !important;
    font-style: italic;
    font-family: var(--font-main) !important;
}

/* LOG CONSOLE */
.log-console {
    background: #080a0f;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-line {
    color: #abb2bf;
    word-break: break-all;
}
.log-line.error { color: #f6465d; }
.log-line.info { color: #61afef; }

/* CHART */
.chart-container {
    height: 220px;
    position: relative;
}

/* RULES LIST */
.rule-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.rule-icon.ok {
    color: var(--color-buy);
    font-weight: bold;
}

.rule-content strong {
    color: var(--text-primary);
}

/* TOASTS */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    border-left: 4px solid var(--accent-gold);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    font-size: 13px;
    animation: slideIn 0.3s ease forwards;
}

.toast.success { border-color: var(--color-buy); }
.toast.error { border-color: var(--color-sell); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* AUTO-TRADING RADAR PANEL */
.auto-trade-section {
    margin-bottom: 20px;
}

.auto-trade-card {
    background: linear-gradient(145deg, #161c23 0%, #1a222c 100%);
    border: 1px solid rgba(245, 172, 0, 0.35);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

.at-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pulsing-beacon {
    width: 14px;
    height: 14px;
    background-color: #0ecb81;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(14, 203, 129, 0.7);
    animation: beaconPulse 1.8s infinite;
}

.pulsing-beacon.paused {
    background-color: #f5ac00;
    box-shadow: 0 0 0 0 rgba(245, 172, 0, 0.7);
    animation: none;
}

@keyframes beaconPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(14, 203, 129, 0.7);
    }
    70% {
        transform: scale(1.15);
        box-shadow: 0 0 0 10px rgba(14, 203, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(14, 203, 129, 0);
    }
}

.at-title-group h3 {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.at-status-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-auto-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-auto-toggle.active {
    background: rgba(246, 70, 93, 0.15);
    color: #f6465d;
    border: 1px solid rgba(246, 70, 93, 0.4);
}

.btn-auto-toggle.active:hover {
    background: rgba(246, 70, 93, 0.25);
}

.btn-auto-toggle.inactive {
    background: rgba(14, 203, 129, 0.15);
    color: #0ecb81;
    border: 1px solid rgba(14, 203, 129, 0.4);
}

.btn-auto-toggle.inactive:hover {
    background: rgba(14, 203, 129, 0.25);
}

.at-radar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.at-radar-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.radar-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.radar-val {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.radar-sub {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.at-live-message {
    background: rgba(0, 0, 0, 0.25);
    border-left: 3px solid var(--accent-gold);
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 12.5px;
    color: var(--text-primary);
}

/* LIVE ACTIVE TRADE HERO CARD */
.active-trade-section {
    margin-bottom: 20px;
}

.active-trade-card {
    background: linear-gradient(135deg, #141b22 0%, #1c2633 100%);
    border: 2px solid #0ecb81;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: 0 8px 30px rgba(14, 203, 129, 0.2);
    position: relative;
    overflow: hidden;
}

.active-trade-card.empty {
    border: 1px dashed var(--border-color);
    box-shadow: none;
    background: var(--bg-card);
    padding: 16px 20px;
}

.atc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.atc-badge-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-dot-pulse {
    width: 12px;
    height: 12px;
    background-color: #0ecb81;
    border-radius: 50%;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(14, 203, 129, 0.8); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 8px rgba(14, 203, 129, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(14, 203, 129, 0); }
}

.atc-type-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.atc-symbol {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.atc-ticket {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.atc-pnl-group {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.atc-pnl-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.atc-pnl-val {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(14, 203, 129, 0.4);
}

.atc-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 16px;
}

.atc-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.atc-m-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.atc-m-val {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.atc-m-val.highlight {
    color: #f5ac00;
    font-weight: 700;
}

.btn-take-profit-now {
    background: linear-gradient(135deg, #0ecb81 0%, #0ba366 100%);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(14, 203, 129, 0.35);
    transition: var(--transition);
    white-space: nowrap;
}

.btn-take-profit-now:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(14, 203, 129, 0.5);
}

.atc-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.atc-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.atc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f5ac00 0%, #0ecb81 100%);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.atc-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.atc-empty {
    display: flex;
    align-items: center;
    gap: 14px;
}

.atc-empty-icon {
    font-size: 24px;
}

.atc-empty-text {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--text-secondary);
}

.atc-empty-text strong {
    color: var(--text-primary);
}

