:root {
    --primary: #3370ff;
    --success: #00b42a;
    --warning: #ff7d00;
    --danger: #f53f3f;
    --info: #165dff;
    --bg-1: #ffffff;
    --bg-2: #f7f8fa;
    --bg-3: #f2f3f5;
    --text-1: #1d2129;
    --text-2: #4e5969;
    --text-3: #86909c;
    --border-1: #e5e6eb;
    --border-2: #c9cdd4;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-3: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 
                 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: var(--text-1);
    background: var(--bg-2);
    line-height: 1.5;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-1);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-1);
}

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

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

.app-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-1);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-2);
    border-radius: 12px;
}

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

.status-dot.active {
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

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

/* Buttons */
.btn-primary, .btn-secondary, .btn-icon {
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
}

.btn-primary:hover {
    background: #2b5ce6;
    box-shadow: var(--shadow-2);
}

.btn-secondary {
    background: var(--bg-2);
    color: var(--text-2);
    padding: 8px 16px;
    border: 1px solid var(--border-1);
}

.btn-secondary:hover {
    background: var(--bg-3);
}

.btn-icon {
    background: transparent;
    color: var(--text-2);
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-2);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: 4px;
}

.btn-close:hover {
    color: var(--text-1);
}

/* Body Layout */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.app-sidebar {
    width: 280px;
    background: var(--bg-1);
    border-right: 1px solid var(--border-1);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-1);
}

.section-header {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* Model List */
.model-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-item {
    padding: 12px;
    background: var(--bg-2);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.model-item:hover {
    background: var(--bg-3);
    transform: translateX(2px);
}

.model-item.active {
    background: #e8f4ff;
    border-left-color: var(--primary);
}

.model-name {
    font-weight: 500;
    color: var(--text-1);
    font-size: 14px;
}

.model-info {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-3);
}

.model-delete {
    color: var(--danger);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.model-item:hover .model-delete {
    opacity: 1;
}

/* Market Prices */
.market-prices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-2);
    border-radius: var(--radius);
}

.price-symbol {
    font-weight: 500;
    color: var(--text-1);
}

.price-value {
    font-weight: 600;
    font-size: 13px;
}

.price-change {
    font-size: 12px;
    margin-top: 2px;
}

.price-change.positive {
    color: var(--success);
}

.price-change.negative {
    color: var(--danger);
}

/* Main Content */
.app-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-1);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-1);
    box-shadow: var(--shadow-1);
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-2);
}

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

.stat-label {
    font-size: 13px;
    color: var(--text-3);
    font-weight: 500;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-1);
}

.stat-value.positive {
    color: var(--success);
}

.stat-value.negative {
    color: var(--danger);
}

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

/* Content Card */
.content-card {
    background: var(--bg-1);
    border-radius: var(--radius);
    border: 1px solid var(--border-1);
    box-shadow: var(--shadow-1);
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-1);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
}

.card-body {
    padding: 20px;
    overflow: hidden;
}

#accountChart {
    width: 100% !important;
    height: 300px !important;
}

/* Tabs */
.card-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-1);
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-1);
}

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

.tab-content {
    display: none;
    padding: 20px;
}

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

/* Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-2);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    border-bottom: 1px solid var(--border-1);
}

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

.data-table tr:hover {
    background: var(--bg-2);
}

.empty-state {
    text-align: center;
    color: var(--text-3);
    padding: 40px !important;
}

/* Badge */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-long {
    background: #ffe7e7;
    color: #f53f3f;
}

.badge-short {
    background: #e8ffea;
    color: #00b42a;
}

.badge-buy {
    background: #e8f7ff;
    color: #0fc6c2;
}

.badge-sell {
    background: #fff4e8;
    color: #ff7d00;
}

.badge-close {
    background: #f2f3f5;
    color: #86909c;
}

/* Conversations */
.conversations-list {
    max-height: 500px;
    overflow-y: auto;
}

.conversation-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-1);
}

.conversation-item:last-child {
    border-bottom: none;
}

.conversation-time {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 8px;
}

.conversation-content {
    background: var(--bg-2);
    padding: 12px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-2);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-1);
    border-radius: var(--radius);
    width: 500px;
    max-width: 90%;
    box-shadow: var(--shadow-3);
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-1);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-1);
    border-radius: var(--radius);
    font-size: 14px;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(51, 112, 255, 0.1);
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-sidebar {
        display: none;
    }

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

    .app-main {
        padding: 16px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-2);
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}

