* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: #0d1117;
    color: #cbd5e1;
    min-height: 100vh;
    padding: 1rem;
    letter-spacing: -0.025em;
}

@media (min-width: 768px) {
    body {
        padding: 2.5rem;
    }
}

/* === LOGIN SCREEN === */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0d1117;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    width: 90%;
    max-width: 400px;
    background: #161b22;
    border: 1px solid #1e293b;
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header svg {
    color: #3b82f6;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.875rem;
    color: #94a3b8;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input {
    width: 100%;
    background: #0d1117;
    border: 1px solid #1e293b;
    border-radius: 0.5rem;
    padding: 1rem;
    color: white;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: #3b82f6;
}

.btn-login {
    width: 100%;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #2563eb;
}

.login-error {
    color: #ef4444;
    font-size: 0.875rem;
    text-align: center;
    min-height: 1.25rem;
}

.btn-logout {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 0.75rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
}

.btn-logout:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.btn-logout svg {
    width: 16px;
    height: 16px;
}



.main-container {
    max-width: 1536px;
    margin: 0 auto;
}

/* === HEADER === */
.header {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

@media (min-width: 768px) {
    .header {
        flex-direction: row;
        align-items: center;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-box {
    background: white;
    padding: 0.625rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-box svg {
    color: black;
}

.main-title {
    font-size: 1.25rem;
    font-weight: 900;
    color: white;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    line-height: 1.2;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.25rem;
}

.meta-item {
    font-size: 0.625rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.meta-item svg {
    color: #64748b;
}

.status-online {
    font-size: 0.625rem;
    font-weight: 700;
    color: #10b981;
    text-transform: uppercase;
}

.header-right {
    background: rgba(30, 41, 59, 0.3);
    padding: 0.375rem;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.5);
    display: flex;
    align-items: center;
}

.total-capital-box {
    display: flex;
    align-items: center;
}

.capital-info {
    padding: 0 1.5rem;
}

.capital-label {
    font-size: 0.625rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    display: block;
}

.capital-amount {
    font-size: 1.25rem;
    font-weight: 900;
    color: white;
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
}

.btn-refresh {
    background: #475569;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-refresh:hover {
    background: #64748b;
}

.btn-refresh svg {
    color: white;
}

/* === ACCOUNTS GRID === */
.accounts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (min-width: 1024px) {
    .accounts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.account-panel {
    display: flex;
    flex-direction: column;
    background: #161b22;
    border: 1px solid #1e293b;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.accent-line {
    height: 0.25rem;
    width: 100%;
}

.accent-blue {
    background: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.accent-emerald {
    background: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.panel-content {
    padding: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.panel-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-box {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    border: 1px solid #334155;
}

.icon-box svg {
    color: #94a3b8;
}

.panel-name {
    font-size: 0.875rem;
    font-weight: 900;
    color: #f1f5f9;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.panel-id {
    font-size: 0.625rem;
    color: #64748b;
    font-family: 'Courier New', monospace;
}

.panel-status {
    text-align: right;
}

.status-label {
    font-size: 0.625rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.25rem;
}

.status-badge {
    font-size: 0.625rem;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

.status-badge.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* === EQUITY SECTION === */
.equity-section {
    margin-bottom: 2rem;
}

.equity-label {
    font-size: 0.6875rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 0.5rem;
}

.equity-amount {
    font-size: 2.25rem;
    font-weight: 300;
    color: white;
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
}

/* === MARGIN SECTION === */
.margin-section {
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 2rem;
}

.margin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.margin-label {
    font-size: 0.6875rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
}

.margin-value {
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: #f1f5f9;
}

.progress-bar {
    position: relative;
    height: 0.375rem;
    width: 100%;
    background: #0f172a;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transition: width 1s ease-in-out;
}

.margin-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.025em;
}

.margin-footer .margin-text:first-child {
    color: #475569;
}

.margin-footer .margin-text:last-child {
    color: #64748b;
}

/* === PNL GRID === */
.pnl-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(30, 41, 59, 0.5);
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

.pnl-item {
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(71, 85, 105, 0.5);
    padding-left: 1rem;
}

.pnl-item:first-child {
    border-left: none;
    padding-left: 0;
}

.pnl-label {
    font-size: 0.625rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.025em;
}

.pnl-value {
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
    font-weight: 700;
}

.pnl-value.positive {
    color: #34d399;
}

.pnl-value.negative {
    color: #f87171;
}

/* === POSITIONS === */
.positions-section {
    margin-top: 1rem;
}

.positions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.positions-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 900;
    color: #94a3b8;
    text-transform: uppercase;
}

.positions-title svg {
    color: #94a3b8;
}

.positions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.position-card {
    background: rgba(30, 41, 59, 0.2);
    border: 1px solid rgba(71, 85, 105, 0.5);
    padding: 1rem;
    border-radius: 0.75rem;
    transition: all 0.3s;
}

.position-card:hover {
    border-color: rgba(148, 163, 184, 0.5);
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.position-symbol {
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.025em;
}

.position-side {
    font-size: 0.625rem;
    font-weight: 900;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.position-side.long {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.position-side.short {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.position-status {
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid;
    font-size: 0.5625rem;
    font-weight: 700;
}

.position-status.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}

.position-status.warning {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.position-main-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

.position-info-item {
    display: flex;
    flex-direction: column;
}

.position-info-item.right {
    align-items: flex-end;
}

.position-info-label {
    font-size: 0.625rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.position-info-value {
    color: #cbd5e1;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.position-info-value.pnl {
    font-weight: 700;
}

.position-info-value.pnl.positive {
    color: #34d399;
}

.position-info-value.pnl.negative {
    color: #f87171;
}

.position-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.position-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.position-detail.right {
    text-align: right;
}

.position-detail-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.5625rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
}

.position-detail.right .position-detail-label {
    justify-content: flex-end;
}

.position-detail-label svg {
    width: 10px;
    height: 10px;
}

.position-detail-label.liquidation {
    color: rgba(239, 68, 68, 0.7);
}

.position-detail-label.liquidation svg {
    color: rgba(239, 68, 68, 0.7);
}

.position-detail-value {
    font-size: 0.6875rem;
    font-family: 'Courier New', monospace;
    color: #cbd5e1;
}

.position-detail.right .position-detail-value {
    text-align: right;
}

.position-detail-value.liquidation {
    color: #ef4444;
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* === TP/SL SECTION === */
.tp-sl-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 0.5rem;
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.tp-sl-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.tp-sl-item.tp {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.tp-sl-item.sl {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.tp-sl-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.tp-sl-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tp-sl-item.tp .tp-sl-header {
    color: #10b981;
}

.tp-sl-item.sl .tp-sl-header {
    color: #ef4444;
}

.tp-sl-header svg {
    width: 12px;
    height: 12px;
}

.tp-sl-value {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: white;
}

.tp-sl-distance {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.tp-sl-distance.positive {
    color: #34d399;
}

.tp-sl-distance.negative {
    color: #f87171;
}

/* === FOOTER STATS === */
.footer-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 3rem;
    opacity: 0.5;
}

@media (min-width: 768px) {
    .footer-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-box {
    background: rgba(30, 41, 59, 0.2);
    border: 1px solid #1e293b;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.stat-label {
    font-size: 0.5625rem;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 0.75rem;
    color: #94a3b8;
    font-family: 'Courier New', monospace;
}

/* === ERROR === */
.error-container {
    margin-top: 1.5rem;
}

.error-message {
    background: #ef4444;
    color: white;
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.no-positions {
    text-align: center;
    padding: 2rem;
    color: #64748b;
    font-size: 0.875rem;
}

/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #161b22;
    border: 1px solid #1e293b;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #1e293b;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
}

.modal-close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #1e293b;
    color: white;
}

.modal-body {
    padding: 1.5rem;
}

.modal-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #1e293b;
}

.modal-symbol {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.modal-side {
    font-size: 0.75rem;
    font-weight: 900;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
}

.modal-side.long {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.modal-side.short {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.modal-price-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

.modal-price-info strong {
    color: white;
    font-weight: 700;
}

/* Profit Preview */
.profit-preview {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.profit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #334155;
}

.profit-item:last-child {
    border-bottom: none;
}

.profit-label {
    font-size: 0.875rem;
    color: #94a3b8;
    font-weight: 500;
}

.profit-value {
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.profit-value.positive {
    color: #10b981;
}

.profit-value.negative {
    color: #ef4444;
}

.profit-value.neutral {
    color: #f59e0b;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}

.input-group input {
    width: 100%;
    background: #0d1117;
    border: 1px solid #1e293b;
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: white;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    margin-bottom: 0.5rem;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
}

.btn-quick {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    margin-right: 0.5rem;
    transition: all 0.2s;
}

.btn-quick:hover {
    background: #334155;
    border-color: #475569;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #1e293b;
}

.btn-cancel,
.btn-confirm {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
}

.btn-cancel:hover {
    background: #334155;
}

.btn-confirm {
    background: #3b82f6;
    border: 1px solid #3b82f6;
    color: white;
}

.btn-confirm:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-set-tpsl {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.625rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.btn-set-tpsl:hover {
    background: #334155;
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-set-tpsl svg {
    width: 14px;
    height: 14px;
}

.position-header-actions {
    display: flex;
    align-items: center;
}
