:root {
    --bg-primary: #090d16;
    --bg-card: #111827;
    --bg-card-alt: #1f2937;
    --border-color: #374151;
    --border-highlight: #4b5563;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-amber: #f59e0b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    font-size: 14px;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #0284c7, #3b82f6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.header-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mode-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.mode-badge.paper {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    border: 1px solid var(--accent-amber);
}

.mode-badge.live {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

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

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);

}

.metric-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.metric-value {
    font-size: 24px;
    font-weight: 800;
    margin: 6px 0;
    color: var(--text-primary);
}

.metric-value.accent {
    color: var(--accent-cyan);
}

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

.font-mono {
    font-family: monospace;
}

/* Webhook Banner */
.webhook-banner {
    background: linear-gradient(135deg, #1e1b4b, #1e293b);
    border: 1px solid #4338ca;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;

}

.webhook-title {
    font-size: 13px;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 8px;
}

.webhook-url-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.webhook-url-box code {
    background: #090d16;
    border: 1px solid #374151;
    color: #38bdf8;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;

}

/* Workspace Grid */
.workspace-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.panel-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;

}

.panel-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    margin: 16px 0 10px 0;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 14px;
}

.highlight-group {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 10px;
    border-radius: var(--radius-sm);
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.form-select, .form-input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #1d4ed8);
}

.btn-secondary {
    background: var(--bg-card-alt);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-save {
    width: 100%;
    background: var(--accent-green);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-top: 14px;
}

.btn-save:hover {
    background: #059669;
}

/* Tabs */
.tab-header {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Data Tables */
.table-wrapper {
    overflow-x: auto;
}

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

.data-table th {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.badge-side {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
}

.badge-side.buy {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.badge-side.sell {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.badge-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.badge-status.success, .badge-status.simulated {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-status.failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 440px;
    padding: 24px;
}

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* Toasts */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    font-size: 13px;
}

.toast.success { background: var(--accent-green); }
.toast.error { background: var(--accent-red); }
.toast.info { background: var(--accent-blue); }
