body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
}

h1, h2, h3 {
    color: #ffffff;
}

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

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.1em;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: white;
    background-color: #333;
}

.tab-btn.active {
    color: white;
    background-color: #1976d2;
    font-weight: bold;
}

/* History Table */
.table-container {
    overflow-x: auto;
    background: #1e1e1e;
    border-radius: 8px;
    padding: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    color: #e0e0e0;
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #333;
}

th {
    color: #888;
    font-weight: normal;
    font-size: 0.9em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #252525;
}

/* Login UI */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-box {
    background-color: #1e1e1e;
    padding: 30px;
    border-radius: 8px;
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.login-box input {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #2c2c2c;
    color: white;
    font-size: 1em;
}

.login-box input:focus {
    outline: none;
    border-color: #1976d2;
}

.error-text {
    color: #f44336;
    font-size: 0.85em;
    text-align: center;
    min-height: 1.2em;
}

/* Header & Global Settings */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

.global-controls {
    background-color: #1e1e1e;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

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

/* Cards Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background-color: #1e1e1e;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.symbol {
    font-size: 1.2em;
    font-weight: bold;
    color: #4caf50;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.status-long { background-color: #2e7d32; color: white; }
.status-short { background-color: #c62828; color: white; }
.status-none { background-color: #424242; color: #aaa; }

.position-info {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #252525;
    border-radius: 4px;
    font-size: 0.9em;
    border-left: 3px solid #666;
}

.position-info.long { border-left-color: #2e7d32; }
.position-info.short { border-left-color: #c62828; }

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.info-row:last-child { margin-bottom: 0; }

.pnl-positive { color: #4caf50; }
.pnl-negative { color: #f44336; }

/* Form Elements */
.form-row {
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

label {
    font-size: 0.9em;
    color: #aaa;
}

input[type="number"] {
    background-color: #2c2c2c;
    border: 1px solid #444;
    color: white;
    padding: 5px;
    border-radius: 4px;
    width: 80px;
}

/* Switches */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Buttons */
button {
    background-color: #333;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #444;
}

button.primary {
    background-color: #1976d2;
}

button.primary:hover {
    background-color: #1565c0;
}

button.danger {
    background-color: #d32f2f;
}

button.danger:hover {
    background-color: #c62828;
}

button.small {
    padding: 4px 8px;
    font-size: 0.8em;
}

.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
}

.loading-overlay.visible {
    visibility: visible;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transform: translateY(100px);
    transition: transform 0.3s;
    z-index: 1001;
}

.toast.visible {
    transform: translateY(0);
}

.toast.success { border-left: 4px solid #4caf50; }
.toast.error { border-left: 4px solid #f44336; }
