:root {
    --bg-color: #0a0e17;
    --card-bg: rgba(20, 28, 50, 0.9);
    --header-bg: linear-gradient(135deg, rgba(13, 19, 33, 0.95), rgba(20, 30, 55, 0.95));
    --accent-blue: #4DA8DA;
    --accent-green: #00FF7F;
    --accent-red: #FF4500;
    --text-primary: #e8edf5;
    --text-secondary: #5a6e8a;
    --border-color: rgba(77, 168, 218, 0.2);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header-bar {
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 100px;
    height: auto;
}

.title-group h1 {
    font-size: 28px;
    color: var(--accent-blue);
    margin: 0;
}

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

.header-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.bot-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.btn-bot {
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn-bot.start {
    background: rgba(0, 255, 127, 0.1);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.btn-bot.start:hover {
    background: var(--accent-green);
    color: var(--bg-color);
}

.btn-bot.stop {
    background: rgba(255, 69, 0, 0.1);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.btn-bot.stop:hover {
    background: var(--accent-red);
    color: var(--text-primary);
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}

.status-badge.live {
    color: var(--accent-green);
    background: rgba(0, 255, 127, 0.08);
    border: 1px solid rgba(0, 255, 127, 0.25);
}

.sync-time {
    color: var(--text-secondary);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.connection-status {
    font-size: 10px;
    margin-top: 4px;
}

/* KPI Row */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid rgba(77, 168, 218, 0.15);
    border-radius: 14px;
    padding: 18px 20px;
    text-align: center;
}

.kpi-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 22px;
    color: var(--text-primary);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.small-mono {
    font-size: 14px;
    margin-top: 5px;
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

.section {
    background: rgba(15, 22, 40, 0.4);
    border: 1px solid rgba(77, 168, 218, 0.1);
    border-radius: 14px;
    padding: 20px;
}

.section-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Control Panel */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 14px;
    color: var(--text-secondary);
}

.toggle-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

/* Sliders & Inputs */
input[type="range"] {
    width: 100%;
    accent-color: var(--accent-blue);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.value-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--accent-blue);
    min-width: 45px;
}

/* Premium Number Input */
.premium-input {
    background: #161b22;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    width: 100%;
    outline: none;
    transition: all 0.3s ease;
}

.premium-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(77, 168, 218, 0.15);
}

.input-container {
    margin-top: 5px;
}

select {
    background: #161b22;
    border: 1px solid var(--border-color);
    color: white;
    padding: 8px;
    border-radius: 6px;
    outline: none;
}

/* Toggles */
.toggle-switch {
    width: 40px;
    height: 20px;
    appearance: none;
    background: #30363d;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-switch:checked {
    background: var(--accent-blue);
}

.toggle-switch.kill:checked {
    background: var(--accent-red);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    background: white;
    transition: 0.3s;
}

.toggle-switch:checked::before {
    left: 22px;
}

/* Buttons */
button {
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    border-radius: 6px;
    padding: 10px;
    border: none;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: #3b8eb8;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.btn-secondary:hover {
    background: rgba(0, 255, 127, 0.1);
}

.btn-close {
    background: rgba(255, 69, 0, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(255, 69, 0, 0.3);
    padding: 5px 10px;
}

/* AI Hub */
.hub-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-line {
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-val {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

/* Progress Bar */
.progress-container {
    margin-top: 10px;
}

.progress-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.progress-bar {
    height: 8px;
    background: #161b22;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    transition: width 0.5s ease-in-out;
}

/* Market List */
.market-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.market-card {
    background: rgba(15, 22, 40, 0.95);
    border: 1px solid rgba(77, 168, 218, 0.12);
    border-radius: 12px;
    padding: 15px;
}

.market-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.symbol-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-blue);
}

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

.regime-badge.EXPANSION { background: rgba(77, 168, 218, 0.2); color: var(--accent-blue); border: 1px solid rgba(77, 168, 218, 0.4); }
.regime-badge.CONSOLIDATION { background: rgba(136, 136, 136, 0.1); color: #888; border: 1px solid rgba(136, 136, 136, 0.3); }

.zone-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
.zone-badge.PREMIUM { background: rgba(255, 69, 0, 0.1); color: var(--accent-red); border: 1px solid rgba(255, 69, 0, 0.3); }
.zone-badge.DISCOUNT { background: rgba(0, 255, 127, 0.1); color: var(--accent-green); border: 1px solid rgba(0, 255, 127, 0.3); }
.zone-badge.EQUILIBRIUM { background: rgba(77, 168, 218, 0.1); color: var(--accent-blue); border: 1px solid rgba(77, 168, 218, 0.3); }

.price-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.bias-badges {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.bias-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
}

.bias-badge.BULLISH { background: rgba(0, 255, 127, 0.1); color: var(--accent-green); border: 1px solid rgba(0, 255, 127, 0.3); }
.bias-badge.BEARISH { background: rgba(255, 69, 0, 0.1); color: var(--accent-red); border: 1px solid rgba(255, 69, 0, 0.3); }
.bias-badge.NEUTRAL { background: rgba(136, 136, 136, 0.1); color: #888; border: 1px solid rgba(136, 136, 136, 0.3); }

/* Activity Log */
.log-container {
    height: 250px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 5px;
}

.log-container::-webkit-scrollbar { width: 4px; }
.log-container::-webkit-scrollbar-thumb { background: var(--text-secondary); border-radius: 10px; }

.log-entry {
    color: var(--text-secondary);
}

.log-entry .time { color: var(--accent-blue); }

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

.pos-card {
    background: rgba(15, 22, 40, 0.95);
    border: 1px solid rgba(77, 168, 218, 0.15);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-card.profit { border-left: 3px solid var(--accent-green); }
.pos-card.loss { border-left: 3px solid var(--accent-red); }

.pos-info h4 {
    color: var(--accent-blue);
    margin-bottom: 4px;
}

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

.pos-pnl {
    text-align: right;
    margin-right: 20px;
}

.pnl-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 700;
}

.pnl-val.profit { color: var(--accent-green); }
.pnl-val.loss { color: var(--accent-red); }

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 50px rgba(77, 168, 218, 0.1);
}

.login-logo {
    width: 120px;
    margin-bottom: 20px;
}

.login-box h2 {
    color: var(--accent-blue);
    margin-bottom: 10px;
}

.login-box p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 30px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#admin-password {
    background: #161b22;
    border: 1px solid var(--border-color);
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    text-align: center;
}

.error-msg {
    color: var(--accent-red);
    font-size: 12px;
    margin-top: 10px;
}

.status-msg {
    font-size: 12px;
    margin-top: 5px;
    text-align: center;
}

.empty-msg {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Order History Table */
.order-table-container {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    border-radius: 8px;
    background: rgba(13, 17, 23, 0.5);
}

.order-table-container::-webkit-scrollbar { width: 4px; }
.order-table-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

.order-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.order-table th {
    position: sticky;
    top: 0;
    background: #161b22;
    padding: 12px;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.order-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(77, 168, 218, 0.05);
    color: var(--text-primary);
}

.order-table tr:hover {
    background: rgba(77, 168, 218, 0.03);
}

.order-table .profit { color: var(--accent-green); font-weight: 600; }
.order-table .loss { color: var(--accent-red); font-weight: 600; }

/* SMT Matrix Table */
.smt-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.smt-table th {
    padding: 10px;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.smt-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid rgba(77, 168, 218, 0.05);
}

.row-label {
    font-weight: 700;
    color: var(--text-secondary);
    text-align: left !important;
}

.cell-self {
    color: #30363d;
}

.smt-cell {
    transition: all 0.3s ease;
}

.corr-val {
    font-size: 14px;
    font-weight: 500;
}

.div-label {
    font-size: 9px;
    font-weight: 700;
    margin-top: 4px;
    padding: 2px 4px;
    border-radius: 3px;
}

.smt-bull {
    background: rgba(0, 255, 127, 0.05);
}

.smt-bull .corr-val { color: var(--accent-green); }
.smt-bull .div-label { background: var(--accent-green); color: var(--bg-color); }

.smt-bear {
    background: rgba(255, 69, 0, 0.05);
}

.smt-bear .corr-val { color: var(--accent-red); }
.smt-bear .div-label { background: var(--accent-red); color: white; }

/* Terminal Hub */
.terminal-hub {
    margin-top: 30px;
}

.hub-container {
    padding: 10px 0;
}

.hub-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(77, 168, 218, 0.1), rgba(0, 0, 0, 0.4));
    border: 1px solid rgba(77, 168, 218, 0.2);
    border-radius: 8px;
    padding: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.hub-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(77, 168, 218, 0.2);
    transform: translateY(-2px);
}

.hub-title {
    display: block;
    color: var(--accent-blue);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 1px;
}

.hub-desc {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
}

.hub-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-green);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-green);
}

/* Footer */
.institutional-footer {
    background: rgba(13, 17, 23, 0.95);
    border-top: 1px solid var(--border-color);
    padding: 15px 30px;
    margin-top: 50px;
    backdrop-filter: blur(10px);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-left, .footer-right {
    display: flex;
    gap: 20px;
    font-size: 11px;
    color: var(--text-secondary);
}

.status-ok {
    color: var(--accent-green);
    font-weight: 700;
}

.footer-clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-blue);
    letter-spacing: 1px;
}
