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

body{
    font-family:Arial,Helvetica,sans-serif;
    background:#eef2f7;
    color:#1f2937;
}

.topbar{
    background:#0f172a;
    color:#fff;
    padding:18px;
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.brand-small{
    font-size:11px;
    letter-spacing:2px;
    opacity:.8;
}

.topbar h1{
    margin-top:4px;
    font-size:28px;
}

.live-indicator{
    display:flex;
    align-items:center;
    gap:8px;
    font-weight:bold;
}

.live-dot{
    width:10px;
    height:10px;
    border-radius:50%;
    background:#22c55e;
}

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

.summary-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
    gap:16px;
}

.summary-card{
    background:#fff;
    border-radius:14px;
    padding:18px;
    box-shadow:0 4px 12px rgba(0,0,0,.08);
}

.summary-label{
    display:block;
    color:#666;
    margin-bottom:10px;
}

.summary-card strong{
    font-size:30px;
}

.update-bar{
    display:flex;
    justify-content:space-between;
    margin:20px 0;
    color:#555;
    font-size:14px;
}

.account-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(330px,1fr));
    gap:18px;
}

.account-card{
    background:#fff;
    border-radius:16px;
    padding:20px;
    box-shadow:0 5px 14px rgba(0,0,0,.08);
    cursor:pointer;
    transition:.2s;
}

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

.account-title{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:15px;
}

.status{
    padding:4px 10px;
    border-radius:20px;
    font-size:12px;
    color:#fff;
}

.connected{
    background:#16a34a;
}

.offline{
    background:#dc2626;
}

.info-row{
    display:flex;
    justify-content:space-between;
    margin:8px 0;
}

.pnl-positive{
    color:#16a34a;
    font-weight:bold;
}

.pnl-negative{
    color:#dc2626;
    font-weight:bold;
}

.modal{
    display:none;
    position:fixed;
    inset:0;
    z-index:999;
}

.modal.active{
    display:block;
}

.modal-overlay{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,.5);
}

.modal-panel{
    position:absolute;
    right:0;
    top:0;
    width:420px;
    max-width:100%;
    height:100%;
    background:#fff;
    overflow:auto;
    padding:20px;
}

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

.close-button{
    border:none;
    background:none;
    font-size:30px;
    cursor:pointer;
}

@media(max-width:700px){

.topbar{
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
}

.topbar h1{
    font-size:22px;
}

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

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

.update-bar{
    flex-direction:column;
    gap:6px;
}

.modal-panel{
    width:100%;
}

}

.account-pnl{
    display:flex;
    justify-content:space-between;
    align-items:center;
    background:#f8fafc;
    border-radius:12px;
    padding:14px;
    margin-bottom:16px;
}

.account-pnl span{
    color:#64748b;
    font-size:14px;
}

.account-pnl strong{
    font-size:24px;
}

.card-footer{
    margin-top:16px;
    padding-top:14px;
    border-top:1px solid #e5e7eb;
    text-align:center;
    font-size:13px;
    color:#2563eb;
    font-weight:bold;
}

.detail-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
}

.detail-grid > div{
    background:#f8fafc;
    border-radius:10px;
    padding:12px;
}

.detail-grid span{
    display:block;
    color:#64748b;
    font-size:12px;
    margin-bottom:6px;
}

.detail-grid strong{
    font-size:15px;
    word-break:break-word;
}

.account-details{
    margin-bottom:18px;
}

.modal-pnl-box{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin:18px 0;
    padding:16px;
    border-radius:12px;
    background:#0f172a;
    color:#fff;
}

.modal-pnl-box strong{
    font-size:24px;
}

.section-title{
    margin:22px 0 12px;
    font-size:18px;
}

.position-card{
    border:1px solid #e5e7eb;
    border-radius:14px;
    padding:15px;
    margin-bottom:14px;
    background:#fff;
}

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

.position-side{
    background:#fee2e2;
    color:#b91c1c;
    border-radius:20px;
    padding:4px 9px;
    font-size:12px;
    font-weight:bold;
}

.position-symbol{
    font-size:13px;
    color:#475569;
    margin-bottom:14px;
    word-break:break-word;
}

.stop-status{
    margin-top:12px;
    padding:10px;
    text-align:center;
    border-radius:9px;
    background:#dcfce7;
    color:#166534;
    font-size:13px;
}

.detail-empty{
    padding:25px;
    text-align:center;
    background:#f8fafc;
    border-radius:12px;
    color:#64748b;
}

@media(max-width:700px){

    body{
        background:#f1f5f9;
    }

    .container{
        padding:12px;
    }

    .summary-grid{
        grid-template-columns:repeat(2,1fr);
        gap:10px;
    }

    .summary-card{
        padding:14px;
    }

    .summary-card strong{
        font-size:24px;
    }

    .pnl-summary{
        grid-column:1 / -1;
    }

    .account-card{
        padding:16px;
        border-radius:14px;
    }

    .account-title h2{
        font-size:20px;
    }

    .status{
        font-size:10px;
        padding:4px 7px;
    }

    .detail-grid{
        grid-template-columns:1fr 1fr;
        gap:8px;
    }

    .detail-grid > div{
        padding:10px;
    }

    .modal-panel{
        padding:16px;
    }

    .modal-header{
        position:sticky;
        top:0;
        background:#fff;
        padding-bottom:12px;
        z-index:2;
    }

}
.wallet-section{
    margin-top:24px;
    background:#ffffff;
    border-radius:16px;
    padding:20px;
    box-shadow:0 10px 25px rgba(15,23,42,.08);
}

.wallet-section h2{
    margin:0 0 18px;
    font-size:22px;
    color:#0f172a;
}

#walletSummary{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:15px;
    margin-bottom:20px;
}

.wallet-box{
    background:#f8fafc;
    border-radius:12px;
    padding:14px;
    text-align:center;
    border:1px solid #e2e8f0;
}

.wallet-box span{
    display:block;
    font-size:12px;
    color:#64748b;
    margin-bottom:6px;
}

.wallet-box strong{
    font-size:22px;
    color:#0f172a;
}

.wallet-row{
    display:grid;
    grid-template-columns:140px 1fr 120px;
    gap:12px;
    padding:12px 0;
    border-bottom:1px solid #e5e7eb;
    align-items:center;
}

.wallet-row:last-child{
    border-bottom:none;
}

.wallet-date{
    color:#64748b;
    font-size:13px;
}

.wallet-account{
    font-weight:600;
}

.wallet-amount{
    text-align:right;
    font-weight:bold;
}

.wallet-empty{
    text-align:center;
    padding:20px;
    color:#64748b;
}

@media(max-width:700px){

    #walletSummary{
        grid-template-columns:1fr;
    }

    .wallet-row{
        grid-template-columns:1fr;
        gap:4px;
    }

    .wallet-amount{
        text-align:left;
    }

}

.broker-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.upstox-login-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.trading-status {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.trading-status.checking {
    background: #eef2f7;
    color: #596579;
}

.trading-status.ready {
    background: #e8f8ef;
    color: #11733d;
}

.trading-status.required {
    background: #fff1f0;
    color: #b42318;
}

.start-trading-button {
    border: 0;
    border-radius: 9px;
    padding: 10px 15px;
    background: #2457e6;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.start-trading-button:hover {
    filter: brightness(0.95);
}

@media (max-width: 700px) {
    .broker-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }
}



/* BTP | BacktestPrime Branding */
.brand-wrap{
    display:flex;
    align-items:center;
    gap:13px;
}

.brand-logo{
    width:52px;
    height:52px;
    flex:0 0 52px;
    border-radius:13px;
    box-shadow:0 8px 22px rgba(37,99,235,.30);
}

.brand-small{
    font-size:10px;
    letter-spacing:2.4px;
    opacity:.76;
}

.topbar h1{
    margin-top:1px;
    font-size:25px;
    line-height:1;
    letter-spacing:.5px;
}

.brand-tagline{
    margin-top:5px;
    font-size:11px;
    color:#cbd5e1;
    letter-spacing:.25px;
}

@media(max-width:700px){
    .brand-logo{
        width:46px;
        height:46px;
        flex-basis:46px;
    }

    .topbar h1{
        font-size:23px;
    }

    .brand-tagline{
        font-size:10px;
    }
}
