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

html,
body {
    width: 100%;
    height: 100%;
}

/* ===========================================================
   BODY
=========================================================== */
body {
    background: #111827;
    color: #E5E7EB;
    font-family:
        Inter,
        "Segoe UI",
        Arial,
        sans-serif;
}

/* ===========================================================
   APP
=========================================================== */
#app {
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}


/* ===========================================================
   HEADER V2
=========================================================== */

.topbar{

    display:grid;

    grid-template-columns:
        max-content
        1fr
        max-content;

    align-items:start;

    gap:24px;

    padding:14px 0 18px;
}

/* ===========================================================
   LEFT
=========================================================== */

.topbar-left{
    width:270px;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.title{

    display:flex;

    gap:12px;

    align-items:flex-start;

}

.logo{

    width:58px;

    height:58px;

    border-radius:8px;

}

.title-text h1{

    margin:0;

    font-size:28px;

    font-weight:800;

    line-height:1.1;

}

.title-text span{

    display:block;

    margin-top:4px;

    color:#AAB3C5;

    font-size:14px;

}

.status-container{

    display:flex;

    gap:6px;

    padding-left:0;

    flex-wrap:nowrap;

}

/* ===========================================================
   CENTER
=========================================================== */

.topbar-center{

    display:flex;

    justify-content:center;

    overflow:hidden;

}

.tabs{

    display:flex;

    gap:8px;

}

/* ===========================================================
   MENU
=========================================================== */

.tab-btn{

    display:flex;

    align-items:center;

    justify-content:center;

    gap:8px;

    min-width:120px;

    height:56px;

    padding:0 14px;

    border:none;

    border-radius:14px;

    background:#2A364C;

    color:#FFFFFF;

    cursor:pointer;

    font-size:13px;

    font-weight:700;

    transition:.20s;

}

.tab-btn:hover{

    transform:translateY(-2px);

}

.tab-btn i{

    font-size:15px;

}

.tab-btn.active{

    background:linear-gradient(
        180deg,
        #3B82F6,
        #2563EB
    );

    box-shadow:
        0 0 18px rgba(37,99,235,.35);

}

/* ===========================================================
   RIGHT
=========================================================== */

.topbar-right{

    display:flex;

    align-items:flex-start;

    gap:12px;

    flex-shrink:0;

}





/* ===========================================================
   HEADER ACCOUNT SUMMARY
=========================================================== */

.header-account{

    display:flex;

    align-items:center;

    gap:14px;

}

/* ==========================
   TOTAL SALDO CARD
========================== */

.header-wallet-card{

    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;

    flex-direction:row;

    min-width:160px;

    height:56px;

    padding:8px 12px;

    border-radius:16px;

    background:#273449;

    border:1px solid rgba(255,255,255,.06);

    box-sizing:border-box;

}

.wallet-info{
    flex:1;
}

.wallet-caption{

    font-size:10px;

    color:#8F9BB3;

    font-weight:600;

    text-transform:uppercase;

    letter-spacing:.6px;

}

.wallet-total{

    margin-top:2px;

    font-size:16px;

    font-weight:800;

    color:#F6C453;

    line-height:1.2;

}

.wallet-subtitle{

    margin-top:2px;

    font-size:10px;

    color:#8F9BB3;

}

/* ==========================
   DEPOSIT BUTTON
========================== */

.header-deposit-btn{

    display:flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
    gap:8px;

    width:auto;
    height:44px;
    padding:0 18px;

    border:none;

    border-radius:12px;

    cursor:pointer;

    color:#FFFFFF;

    font-size:14px;

    font-weight:700;

    background:linear-gradient(
        180deg,
        #4D8DFF 0%,
        #2563EB 100%
    );

    box-shadow:
        0 0 12px rgba(37,99,235,.30);

    transition:.2s;

}

.header-deposit-btn:hover{

    transform:translateY(-2px);

    box-shadow:
        0 8px 22px rgba(37,99,235,.45);

}

/* ===========================================================
   SUMMARY
=========================================================== */
.summary{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 15px;
}

.summary-card {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 13px;
    text-align: center;
    transition: .25s;
}

.summary-card:hover {
    border-color: #60A5FA;
    transform: translateY(-2px);
}

.summary-card label {
    display: block;
    font-size: 13px;
    color: #94A3B8;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.summary-card span {
    font-size: 24px;
    font-weight: 700;
}

/* ===========================================================
   SUMMARY COLOR
=========================================================== */
.long span {
    color: #22C55E;
}

.mark span {
    color: #FACC15;
}

.short span {
    color: #EF4444;
}

.pnl span {
    color: #60A5FA;
}

/* ===========================================================
   CHART GRID
=========================================================== */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* ===========================================================
   CHART CARD & PANEL COMPONENT
=========================================================== */
.chart-card,
.card {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 12px;
    overflow: hidden;
}

.chart-title,
.card-header {
    padding: 14px 18px;
    background: #273449;
    color: white;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid #374151;
    letter-spacing: 0.5px;
}

/* ===========================================================
   CHART
=========================================================== */
.chart {
    width: 100%;
    height: 220px;
}

/* ===========================================================
   TABEL UTAMA: ORDER TERBUKA
=========================================================== */
#openOrdersTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}

#openOrdersTable th {
    text-align: left;
    padding: 10px 12px;
    color: #9CA3AF;
    border-bottom: 1px solid #374151;
    font-weight: 600;
}

#openOrdersTable td {
    padding: 10px 12px;
    border-bottom: 1px solid #2D3748;
    color: #F3F4F6;
}

#openOrdersTable tbody tr:hover {
    background: #1F2937;
}

.side-buy {
    color: #22C55E;
    font-weight: bold;
}

.side-sell {
    color: #EF4444;
    font-weight: bold;
}

/* ===========================================================
   HISTORY TABLE
=========================================================== */
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-top: 8px;
}

.history-table th {
    background: #111827;
    color: #fff;
    padding: 6px;
}

.history-table td {
    padding: 6px;
    text-align: right;
    border-bottom: 1px solid #374151;
}

.history-table td:first-child,
.history-table th:first-child {
    text-align: center;
}

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

@media (max-width: 900px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .summary {
        grid-template-columns: 1fr;
    }
    
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    
    .title {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .title h1 {
        font-size: 24px;
    }
}

/* ==========================================================================
   IntelID Visual Focus Engine
   Hover Magnification
   ========================================================================== */

:root{
    --focus-scale:1.08;
    --focus-speed:150ms;
}

/* Animasi dasar */
table,
table tr,
table td,
table th,
button{
    transition:
        transform var(--focus-speed) ease,
        background-color var(--focus-speed) ease,
        color var(--focus-speed) ease,
        font-size var(--focus-speed) ease,
        font-weight var(--focus-speed) ease,
        box-shadow var(--focus-speed) ease;
}

/* Highlight seluruh baris */
table tbody tr:hover{
    background:rgba(255,255,255,.06);
    box-shadow:
        inset 4px 0 0 #3B82F6;
}

/* Perbesar isi baris */
table tbody tr:hover td{
    transform:scale(var(--focus-scale));
    transform-origin:left center;
    font-size:1.08em;
    font-weight:700;
    position:relative;
    z-index:5;
}

/* Tombol ikut membesar */
table tbody tr:hover button{
    transform:scale(1.08);
    font-weight:700;
}

/* LONG */
table tbody tr:hover .side-buy{
    color:#4ADE80;
}

/* SHORT */
table tbody tr:hover .side-sell{
    color:#F87171;
}

.connection-monitor{
    display:flex;
    gap:6px;
    flex-wrap:wrap;
    margin-top:6px;
}

.status-chip{

    display:inline-flex;

    align-items:center;

    justify-content:center;

    min-width:50px;

    height:20px;

    font-size:9px;

    padding:2px 8px;

    border-radius:999px;

    font-weight:700;

    letter-spacing:.3px;

}

.status-chip.online{

    color:#001A08;

    background:linear-gradient(
        180deg,
        #8CFF9E 0%,
        #00F260 45%,
        #00C853 100%
    );

    border:1px solid #6CFF8A;

    box-shadow:
        0 0 6px rgba(0,255,120,.65),
        0 0 14px rgba(0,255,120,.45),
        inset 0 1px 1px rgba(255,255,255,.65);

}

.status-chip.offline{

    color:#FFECEC;

    background:linear-gradient(
        180deg,
        #FF7B7B 0%,
        #FF3B30 45%,
        #C62828 100%
    );

    border:1px solid #FF9E9E;

    box-shadow:
        0 0 6px rgba(255,70,70,.55),
        inset 0 1px 1px rgba(255,255,255,.35);

}

/* ==========================================================
   Trading Workspace
   Hedge Balancer Recommendation
   ========================================================== */

#twLongEntry,
#twMarkPrice,
#twShortEntry,
#twBalancerMargin,
#twBalancerAmount,
#twBalancerPercent,
#twBalancerAction{
    font-size:28px;
    font-weight:800;
    font-family:Consolas, Monaco, monospace;
    line-height:1.2;
}

#twLongEntry{
    color:#22C55E;
}

#twMarkPrice{
    color:#F59E0B;
}

#twShortEntry{
    color:#EF4444;
}

#twBalancerMargin{
    color:#FFFFFF;
}

#twBalancerAmount{
    color:#FFFFFF;
}

.tw-balancer-recommendation{
    display:flex;
    flex-direction:column;
}

.tw-balancer-action{
    margin-top:4px;
    font-size:12px;
    font-weight:700;
    letter-spacing:.08em;
    text-transform:uppercase;
}

#twBalancerAction{
    color:#22C55E;
    font-weight:900;
}

#twBalancerPercent{
    color:#9CA3AF;
}

#twBalancerAction.text-up{
    color:#22C55E;
}

#twBalancerAction.text-down{
    color:#EF4444;
}

.ticker-container{
    overflow:hidden;
    white-space:nowrap;
    border-top:1px solid rgba(255,255,255,.08);
    border-bottom:1px solid rgba(255,255,255,.08);
    padding:8px 0;
    margin-bottom:12px;
}

.ticker-track{
    display:inline-block;
    white-space:nowrap;
    animation:tickerMove 40s linear infinite;
}

.ticker-item{
    display:inline-block;
    margin-right:32px;
    font-weight:600;
}

.ticker-up{
    color:#22c55e;
}

.ticker-down{
    color:#ef4444;
}

@keyframes tickerMove{
    from{
        transform:translateX(100%);
    }
    to{
        transform:translateX(-100%);
    }
}

/* ===========================================================
   TRADE ACTION BANNER
=========================================================== */

.trade-action-banner{
    margin-top:12px;
    padding:18px 20px;
    border-radius:10px;
    border:2px solid #374151;
    transition:all .25s ease;
    box-shadow:0 6px 20px rgba(0,0,0,.25);
}

.trade-action-header{
    display:flex;
    align-items:center;
    gap:10px;
    font-size:26px;
    font-weight:800;
    line-height:1.2;
}

#modal-action-icon{
    display:none;
}

#modal-action-name{
    display:block;
}

.trade-action-symbol{
    margin-top:8px;
    margin-bottom:10px;
    font-size:12px;
    font-weight:700;
    letter-spacing:2px;
    text-transform:uppercase;
    opacity:.75;
}

.trade-action-description{
    font-size:14px;
    line-height:1.6;
    opacity:.95;
}

/* ===========================================================
   ACTION COLOR THEMES
=========================================================== */

.trade-action-default{
    background:#1F2937;
    border-color:#374151;
    color:#F3F4F6;
}

.trade-action-long{
    background:linear-gradient(
        135deg,
        rgba(34,197,94,.18),
        rgba(34,197,94,.08)
    );
    border-color:#22C55E;
    color:#4ADE80;
}

.trade-action-short{
    background:linear-gradient(
        135deg,
        rgba(239,68,68,.18),
        rgba(239,68,68,.08)
    );
    border-color:#EF4444;
    color:#F87171;
}

.trade-action-close-long{
    background:linear-gradient(
        135deg,
        rgba(59,130,246,.18),
        rgba(59,130,246,.08)
    );
    border-color:#3B82F6;
    color:#60A5FA;
}

.trade-action-close-short{
    background:linear-gradient(
        135deg,
        rgba(251,146,60,.18),
        rgba(251,146,60,.08)
    );
    border-color:#FB923C;
    color:#FDBA74;
}

.trade-action-stop{
    background:linear-gradient(
        135deg,
        rgba(245,158,11,.18),
        rgba(245,158,11,.08)
    );
    border-color:#F59E0B;
    color:#FBBF24;
}

/* ===========================================================
   SUMMARY CARD
=========================================================== */

.trade-summary-card{
    margin-top:12px;
    padding:14px 16px;
    background:#111827;
    border:1px solid #374151;
    border-radius:8px;
}

.trade-summary-card div{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:6px 0;
}

.trade-summary-card span{
    color:#9CA3AF;
    font-size:13px;
}

.trade-summary-card b{
    color:#F3F4F6;
    font-size:17px;
    font-weight:800;
}

/* ===========================================================
   POSITION CENTER (REFACTORED HIGH-READABILITY)
=========================================================== */

.position-center-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(300px,1fr));
    gap:18px;
    margin-top:20px;
    align-items:start;
}

.pc-card{
    display:flex;
    flex-direction:column;
    background:#1F2937;
    border:1px solid #374151;
    border-radius:14px;
    padding:20px;
    transition:.2s;
    box-shadow:0 8px 24px rgba(0,0,0,.25);
}

.pc-card:hover{
    transform:translateY(-2px);
    border-color:#60A5FA;
}

.pc-title{
    text-align:center;
    font-size:20px;
    font-weight:800;
    color:#F9FAFB;
    text-transform:uppercase;
    letter-spacing:1px;
    padding-bottom:12px;
    margin-bottom:24px;
    border-bottom:1px solid rgba(255,255,255,.08);
}

.pc-grid{
    display:flex;
    flex-direction:column;
    gap:18px;
}

.pc-grid span{
    display:block;
    font-size:12px;
    color:#94A3B8;
    letter-spacing:1px;
    text-transform:uppercase;
    margin-bottom:4px;
}

.pc-grid b{
    display:block;
    line-height:1;
}

.pc-value-price{
    font-size:42px;
    font-weight:800;
    color:#FFFFFF;
}

.pc-value-notional{
    font-size:34px;
    font-weight:800;
    color:#60A5FA;
}

.pc-value-distance{
    font-size:40px;
    font-weight:800;
    color:#FACC15;
}

.pc-value-status{
    font-size:22px;
    font-weight:700;
}

.pc-empty{
    text-align:center;
    padding:40px 10px;
    color:#6B7280;
    font-style:italic;
}

.pc-footer{
    margin-top:24px;
}

.pc-cancel{
    width:100%;
    padding:14px;
    border:none;
    border-radius:10px;
    background:#DC2626;
    color:#FFFFFF;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
    transition:.2s;
}

.pc-cancel:hover{
    background:#B91C1C;
}

.pc-cancel:active{
    transform:scale(.98);
}

@media (max-width:768px){
    .position-center-grid{
        grid-template-columns:1fr;
    }

    .pc-value-price{
        font-size:34px;
    }

    .pc-value-notional{
        font-size:28px;
    }

    .pc-value-distance{
        font-size:32px;
    }

    .pc-value-status{
        font-size:18px;
    }
}
/* ===========================
   OPEN LONG
=========================== */

.pc-open-long{
    border-top:4px solid #22c55e;
}

.pc-open-long .pc-title,
.pc-open-long .pc-value-price,
.pc-open-long .pc-value-notional{
    color:#22c55e;
}

.pc-open-long .pc-cancel{
    background:#22c55e;
}

/* ===========================
   OPEN SHORT
=========================== */

.pc-open-short{
    border-top:4px solid #f59e0b;
}

.pc-open-short .pc-title,
.pc-open-short .pc-value-price,
.pc-open-short .pc-value-notional{
    color:#f59e0b;
}

.pc-open-short .pc-cancel{
    background:#f59e0b;
}

/* ===========================
   CLOSE LONG
=========================== */

.pc-close-long{
    border-top:4px solid #3b82f6;
}

.pc-close-long .pc-title,
.pc-close-long .pc-value-price,
.pc-close-long .pc-value-notional{
    color:#3b82f6;
}

.pc-close-long .pc-cancel{
    background:#3b82f6;
}

/* ===========================
   CLOSE SHORT
=========================== */

.pc-close-short{
    border-top:4px solid #a855f7;
}

.pc-close-short .pc-title,
.pc-close-short .pc-value-price,
.pc-close-short .pc-value-notional{
    color:#a855f7;
}

.pc-close-short .pc-cancel{
    background:#a855f7;
}
#marketTable{
    width:100%;
    border-collapse:collapse;
    table-layout:fixed;
}

#marketTable th{
    padding:10px 12px;
    background:#1f2937;
    white-space:nowrap;
    text-align:center;
}

#marketTable td{
    padding:8px 12px;
    border-bottom:1px solid rgba(255,255,255,.08);
    white-space:nowrap;
}

#marketTable tr:hover{
    background:rgba(255,255,255,.05);
}
.market-table-container{

    overflow-x:auto;

}

#marketTable{

    width:100%;
    border-collapse:collapse;

}

#marketTable th{

    font-size:30px;
    font-weight:700;
    padding:14px 18px;
    white-space:nowrap;

}

#marketTable td{

    font-size:25px;
    padding:13px 18px;
    white-space:nowrap;
    border-bottom:1px solid rgba(255,255,255,.08);

}

#marketTable tbody tr:nth-child(even){

    background:rgba(255,255,255,.02);

}

#marketTable tbody tr:hover{

    background:#334155;

}

#marketTable td.number{

    text-align:right;
    font-family:Consolas,monospace;

}

#marketTable td.point{

    text-align:right;
    font-weight:700;

}

.market-pagination{

    display:flex;
    justify-content:center;
    align-items:center;
    gap:8px;

    margin:20px 0;

}

.market-pagination button{

    min-width:42px;

    padding:8px 14px;

    border:none;

    border-radius:8px;

    background:#334155;

    color:white;

    cursor:pointer;

    font-size:14px;

}

.market-pagination button:hover{

    background:#2563EB;

}

.market-pagination button.active{

    background:#2563EB;

    font-weight:bold;

}

.market-pagination button:disabled{

    opacity:.4;

    cursor:not-allowed;

}
/* ==========================================================
   HISTORY ORDER PANEL
   ========================================================== */

#historyOrdersTable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 14px;
}

#historyOrdersTable thead th {
    background: #273246;
    color: #AFC3E6;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid #3A455C;
    position: sticky;
    top: 0;
    z-index: 2;
    user-select: none;
}

#historyOrdersTable tbody td {
    font-size: 14px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,.05);
    vertical-align: middle;
}

#historyOrdersTable tbody tr {
    transition: background-color .15s ease;
}

#historyOrdersTable tbody tr:hover {
    background: #2F3B52;
}

/* ----------------------------------------------------------
   Kolom
---------------------------------------------------------- */

#historyOrdersTable th:nth-child(1),
#historyOrdersTable td:nth-child(1) {
    width: 90px;
}

#historyOrdersTable th:nth-child(2),
#historyOrdersTable td:nth-child(2) {
    width: 90px;
    font-weight: 700;
}

#historyOrdersTable th:nth-child(3),
#historyOrdersTable td:nth-child(3) {
    width: 110px;
    text-align: right;
    font-family: Consolas, Monaco, monospace;
}

#historyOrdersTable th:nth-child(4),
#historyOrdersTable td:nth-child(4) {
    width: 140px;
    text-align: right;
    font-family: Consolas, Monaco, monospace;
    white-space: nowrap;
}

#historyOrdersTable th:nth-child(5),
#historyOrdersTable td:nth-child(5) {
    width: 110px;
    text-align: center;
    white-space: nowrap;
    font-weight: 700;
}

/* ----------------------------------------------------------
   Warna Posisi
---------------------------------------------------------- */

#historyOrdersTable .text-up {
    color: #20E3A2;
    font-weight: 700;
}

#historyOrdersTable .text-down {
    color: #FF5B6E;
    font-weight: 700;
}

#historyOrdersTable .text-warning {
    color: #FFD54A;
    font-weight: 700;
}

#historyOrdersTable .text-muted {
    color: #9CA3AF;
}

/* ----------------------------------------------------------
   Scrollbar
---------------------------------------------------------- */

#historyOrdersTable::-webkit-scrollbar {
    width: 8px;
}

#historyOrdersTable::-webkit-scrollbar-thumb {
    background: #4B5563;
    border-radius: 4px;
}

#historyOrdersTable::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* ==========================================================
   FUNDING SUMMARY
========================================================== */

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

.funding-item{
    background:#1f2937;
    border:1px solid rgba(255,255,255,.08);
    border-radius:10px;
    padding:16px;
    transition:.2s;
}

.funding-item:hover{
    border-color:#3b82f6;
}

.funding-title{
    font-size:13px;
    color:#9ca3af;
    margin-bottom:8px;
}

.funding-value{
    font-size:22px;
    font-weight:700;
}


/* ==========================================================
   FUNDING HISTORY
========================================================== */

.funding-history-wrapper{

    max-height:340px;

    overflow-y:auto;

    overflow-x:hidden;

}

.funding-table{

    width:100%;

    border-collapse:collapse;

}

.funding-table th{

    position:sticky;

    top:0;

    background:#253247;

    z-index:5;

}

.funding-table th,
.funding-table td{

    padding:10px 14px;

    text-align:left;

    white-space:nowrap;

    border-bottom:1px solid rgba(255,255,255,.05);

}

.funding-table tbody tr:hover{

    background:rgba(255,255,255,.04);

}
/* ==========================================
   RESET & COMMON STYLES
   ========================================== */
.btn-icon-only {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    font-size: 18px;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
}

/* ==========================================
   TRADING TOOLBAR & PANELS
   ========================================== */
.trading-timeframes {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-timeframe {
    background: #1F2937;
    color: #9CA3AF;
    border: 1px solid #374151;
    border-radius: 4px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.btn-timeframe.active {
    background: #2563EB;
    color: #FFFFFF;
    border-color: #3B82F6;
}

.trading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.trading-toolbar {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #374151;
    background: #111827;
}

.btn-toolbar {
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: bold;
}

.btn-anchor { background: #F59E0B; color: #111827; }
.btn-alert { background: #2563EB; color: #FFF; }

.anchor-panel {
    display: none;
    position: absolute;
    top: 56px;
    right: 120px;
    width: 240px;
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(0,0,0,.35);
    z-index: 5000;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #374151;
    font-weight: bold;
}

.btn-action-long {
    padding: 12px; border: none; background: #16A34A; color: #FFF; cursor: pointer; font-weight: bold;
}
.btn-action-short {
    padding: 12px; border: none; background: #DC2626; color: #FFF; cursor: pointer; font-weight: bold;
}

/* ==========================================
   MODAL COMPONENT (Anchor & Alerts)
   ========================================== */
.modal-container {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 10px;
    overflow: hidden;
}

.anchor-modal-box { width: 420px; max-width: 92vw; }
.alert-modal-box { width: min(480px, 90vw); border-radius: 8px; }
.trade-modal-box { width: min(660px, 88vw); border-radius: 8px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.7); }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #374151;
}

.modal-title { font-size: 18px; font-weight: bold; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 18px; }

/* Input Styles */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #CBD5E1;
    letter-spacing: .3px;
}

.trigger-price-input {
    width: 100%;
    height: 58px;
    padding: 0 16px;
    border: 1px solid #3B82F6;
    border-radius: 8px;
    background: #0F172A;
    color: #F8FAFC;
    font-size: 30px;
    font-weight: 800;
    text-align: center;
    letter-spacing: 1px;
    outline: none;
    box-sizing: border-box;
    transition: all .18s ease;
}

.trigger-price-input:focus {
    border-color: #60A5FA;
    box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}

/* Big Display Inputs (Patch 012) */
.large-input-label {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: #E5E7EB;
    margin-bottom: 12px;
}

.large-input {
    width: 100%;
    height: 136px;
    background: #111827;
    border: 1px solid #4B5563;
    border-radius: 8px;
    padding: 0 22px;
    color: #FFF;
    font-size: 60px;
    font-weight: 900;
    line-height: 136px;
    text-align: center;
    box-sizing: border-box;
}

/* Range Slider */
.slider-container { width: 100%; }
.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: #9CA3AF;
    font-size: 12px;
}

/* Modal Footer */
.modal-footer-split {
    display: flex;
    border-top: 1px solid #374151;
}

.modal-footer-split button {
    flex: 1;
    padding: 14px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.btn-cancel { background: transparent; color: #9CA3AF; }
.btn-confirm { background: #2563EB; color: white; }

/* ===========================================================
   Trading Workspace Layout Isolation
=========================================================== */

#tradingTab{
    width:100%;
}

#tradingTab > .card{
    flex-direction:column !important;
    display:flex !important;
    margin-top:20px;
    overflow:hidden;
}

#tradingTab .trading-toolbar{
    width:100%;
    position:relative;
    z-index:10;
}

#tradingTab .modal-overlay{
    position:fixed;
}

#tradingTab .trading-chart-container{
    width:100%;
    height:600px;
    border-radius:8px;
    overflow:hidden;
}

#tradingTab .modal-container{
    box-sizing:border-box;
}

/* ==========================================
   STATUS & WORKSPACE PANELS
   ========================================== */
#tradingTab .trading-workspace-status{
    display:grid;
    grid-template-columns:0.8fr 0.8fr 0.8fr 1.5fr 2fr 1fr;
    align-items:center;
    text-align:center;
    gap:12px;
    width:100%;
    margin-top:14px;
}

#tradingTab .tw-label{ font-size: 11px; color: #9CA3AF; }
#tradingTab .tw-price{ font-size: 14px; font-weight: bold; color: #F8FAFC; }

/* Grid Layouts */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

#trading-confirm-modal .summary-card{
    background:rgba(255,255,255,.08);
    border-radius:6px;
    padding:10px;
}

#trading-confirm-modal .summary-card-highlight {
    background: #2563EB;
    border: 2px solid #60A5FA;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 0 12px rgba(59,130,246,.35);
}

#trading-confirm-modal .card-title {
    font-size: 11px;
    color: #CBD5E1;
    text-transform: uppercase;
    margin-bottom: 4px;
}

#trading-confirm-modal .card-value {
    font-size: 26px;
    font-weight: 900;
    color: #FFFFFF;
}
/* ==========================================================
   Anchor Preview
========================================================== */

.anchor-preview-divider{

    margin:12px 0;

    border:none;

    border-top:1px solid #374151;

}

.anchor-preview-grid{

    display:grid;

    row-gap:10px;

}

.anchor-preview-row{

    display:flex;

    justify-content:space-between;

    align-items:center;

}

.anchor-badge{

    display:inline-flex;

    align-items:center;

    justify-content:center;

    padding:4px 12px;

    border-radius:999px;

    background:#14532D;

    color:#4ADE80;

    font-size:11px;

    font-weight:700;

    white-space:nowrap;

}

.anchor-direction{

    min-width:70px;

}

.anchor-preview-summary{

    display:grid;

    grid-template-columns:repeat(3,1fr);

    gap:12px;

    margin-top:16px;

}

.anchor-summary-card{

    background:#1F2937;

    border:1px solid #374151;

    border-radius:8px;

    padding:12px;

    text-align:center;

}

.anchor-summary-card.success{

    border-color:#22C55E;

}

.anchor-summary-title{

    font-size:10px;

    color:#9CA3AF;

    font-weight:700;

    letter-spacing:.08em;

    margin-bottom:8px;

}

.anchor-summary-value{

    font-size:28px;

    font-weight:800;

    color:#F8FAFC;

    line-height:1;

}

.anchor-summary-card.success
.anchor-summary-value{

    color:#4ADE80;

}

.anchor-summary-unit{

    margin-top:6px;

    font-size:10px;

    color:#9CA3AF;

}
/* =======================================================================
   PATCH-014
   PREMIUM SYSTEM NOTIFICATION
   ======================================================================= */

.system-notification-window{

    width:460px;
    max-width:92vw;

    background:#111827;

    border:1px solid #374151;

    border-radius:14px;

    overflow:hidden;

    box-shadow:
        0 28px 80px rgba(0,0,0,.55);

    animation:notificationPopup .18s ease-out;
}

.system-notification-header{

    display:flex;

    align-items:center;

    gap:16px;

    padding:18px 22px;

    background:#1F2937;

    border-bottom:1px solid #374151;
}

.system-notification-icon{

    width:54px;
    height:54px;

    border-radius:50%;

    display:flex;

    align-items:center;

    justify-content:center;

    font-size:28px;

    font-weight:bold;

    flex-shrink:0;

    background:#374151;

    color:white;
}

.system-notification-title-group{

    flex:1;
}

.system-notification-title{

    font-size:19px;

    font-weight:700;

    color:white;
}

.system-notification-subtitle{

    margin-top:3px;

    font-size:13px;

    color:#9CA3AF;
}

.system-notification-body{

    padding:24px;

    font-size:15px;

    line-height:1.75;

    color:#E5E7EB;

    white-space:pre-line;
}

.system-notification-footer{

    display:flex;

    justify-content:flex-end;

    gap:10px;

    padding:18px 22px;

    border-top:1px solid #374151;

    background:#111827;
}

.system-notification-button{

    min-width:120px;

    padding:11px 18px;

    border:none;

    border-radius:8px;

    cursor:pointer;

    font-weight:700;

    font-size:14px;

    transition:.18s;
}

.system-notification-button:hover{

    transform:translateY(-1px);
}

.system-notification-primary{

    background:#2563EB;

    color:white;
}

.system-notification-primary:hover{

    background:#1D4ED8;
}

.system-notification-danger{

    background:#DC2626;

    color:white;
}

.system-notification-danger:hover{

    background:#B91C1C;
}

.system-notification-secondary{

    background:#374151;

    color:white;
}

.system-notification-secondary:hover{

    background:#4B5563;
}
.system-notification-success .system-notification-icon{

    background:#16A34A;
}

.system-notification-warning .system-notification-icon{

    background:#D97706;
}

.system-notification-error .system-notification-icon{

    background:#DC2626;
}

.system-notification-info .system-notification-icon{

    background:#2563EB;
}

.system-notification-confirm .system-notification-icon{

    background:#4F46E5;
}
@keyframes notificationPopup{

    from{

        opacity:0;

        transform:
            translateY(-16px)
            scale(.95);
    }

    to{

        opacity:1;

        transform:
            translateY(0)
            scale(1);
    }

}
.pc-section-title{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin:18px 0 10px;

    padding-bottom:8px;

    border-bottom:1px solid #374151;

    color:#F9FAFB;

    font-weight:700;

    letter-spacing:.08em;

    text-transform:uppercase;

}

.pc-section-badge{

    min-width:28px;

    height:28px;

    border-radius:14px;

    background:#F59E0B;

    color:#111827;

    display:flex;

    align-items:center;

    justify-content:center;

    font-weight:bold;

}

.pc-algo{

    border-top:4px solid #F59E0B;

}

.pc-row{

    display:flex;

    justify-content:space-between;

    align-items:center;

    margin:10px 0;

}

.pc-row span{

    color:#9CA3AF;

    font-size:12px;

}

.pc-row strong{

    color:#F9FAFB;

    font-weight:700;

}
.btn-cancel-algo{

    width:100%;

    margin-top:10px;

    padding:8px 12px;

    border:none;

    border-radius:6px;

    background:#DC2626;

    color:#FFF;

    font-weight:600;

    cursor:pointer;

}

.btn-cancel-algo:hover{

    background:#B91C1C;

}

/* ==========================================================
   HISTORY SPREAD TABLE (UI Enhancement)
   Non-breaking Patch
========================================================== */

#historySpreadTable{
    width:100%;
    border-collapse:collapse;
    table-layout:fixed;
    font-size:14px;
    background:#1F2937;
}

#historySpreadTable thead th{

    background:#273449;

    color:#AFC3E6;

    font-size:14px;

    font-weight:700;

    padding:10px 12px;

    border-bottom:1px solid #374151;

    text-transform:uppercase;

    letter-spacing:.4px;

    position:sticky;

    top:0;

    z-index:2;

}

#historySpreadTable tbody td{

    padding:9px 12px;

    border-bottom:1px solid rgba(255,255,255,.05);

    color:#F3F4F6;

    font-family:Consolas, Monaco, monospace;

    white-space:nowrap;

}

#historySpreadTable tbody tr:nth-child(even){

    background:rgba(255,255,255,.02);

}

#historySpreadTable tbody tr:hover{

    background:#2F3B52;

    transition:.15s;

}

#historySpreadTable td.number{

    text-align:right;

}

#historySpreadTable td.center{

    text-align:center;

}

#historySpreadTable .text-up{

    color:#22C55E;

    font-weight:700;

}

#historySpreadTable .text-down{

    color:#EF4444;

    font-weight:700;

}

#historySpreadTable .text-warning{

    color:#F59E0B;

    font-weight:700;

}

.history-spread-wrapper{

    max-height:320px;

    overflow-y:auto;

    border:1px solid #374151;

    border-radius:8px;

}

.history-spread-wrapper::-webkit-scrollbar{

    width:8px;

}

.history-spread-wrapper::-webkit-scrollbar-thumb{

    background:#4B5563;

    border-radius:8px;

}
/* ==========================================================
   HISTORY SPREAD POLISH
========================================================== */

/* Lebar kolom lebih proporsional */

#historySpreadTable th:nth-child(1),
#historySpreadTable td:nth-child(1){
    width:30%;
}

#historySpreadTable th:nth-child(2),
#historySpreadTable td:nth-child(2){
    width:40%;
}

#historySpreadTable th:nth-child(3),
#historySpreadTable td:nth-child(3){
    width:30%;
}


/* ==========================================================
   Spread dibuat menjadi fokus utama
========================================================== */

#historySpreadTable td:nth-child(2){

    font-size:15px;

    font-weight:700;

    color:#F8FAFC;

    letter-spacing:.3px;

}


/* ==========================================================
   Balance dibuat lebih hidup
========================================================== */

#historySpreadTable td:nth-child(3){

    font-weight:700;

}

/* Sangat Baik */

#historySpreadTable td.balance-high{

    color:#22C55E;

}

/* Baik */

#historySpreadTable td.balance-medium{

    color:#F59E0B;

}

/* Kurang Seimbang */

#historySpreadTable td.balance-low{

    color:#EF4444;

}


/* ==========================================================
   Hover sedikit lebih elegan
========================================================== */

#historySpreadTable tbody tr{

    transition:
        background .15s ease,
        transform .12s ease;

}

#historySpreadTable tbody tr:hover{

    background:#334155;

    transform:translateX(2px);

}
.distance-debug{

    margin:24px;

    padding:18px;

    background:#181C22;

    border:1px solid #323842;

    border-radius:12px;

}

.distance-debug-title{

    color:#FFD700;

    font-size:18px;

    font-weight:bold;

    margin-bottom:12px;

}

.distance-debug-table{

    width:100%;

    border-collapse:collapse;

}

.distance-debug-table td{

    padding:8px 12px;

    border-bottom:1px solid #2E333A;

}

.distance-debug-table td:first-child{

    color:#9CA3AF;

    width:240px;

}

.distance-debug-table td:last-child{

    color:#00E676;

    font-weight:bold;

    font-family:Consolas, monospace;

}

/* ===========================================================
   TRADING METRICS — HIGH VISIBILITY
   Desktop trading workspace
=========================================================== */

#tradingTab .trading-workspace-status{
    grid-template-columns:
        repeat(6, minmax(0, 1fr)) !important;

    gap: 10px !important;
    align-items: center;
    min-height: 96px;
    padding: 14px 12px !important;
}

/* Individual metric area */
#tradingTab .trading-workspace-status > div{
    min-width: 0;
    padding: 10px 8px;
    text-align: center;
}

/* Labels: LONG / MARK / SHORT / MARGIN / REKOMENDASI / SPREAD */
#tradingTab .trading-workspace-status .tw-label{
    display: block;
    margin-bottom: 7px;
    color: #9CA3AF;
    font-size: 13px !important;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: .08em;
}

/* Main numerical values */
#tradingTab #twLongEntry,
#tradingTab #twMarkPrice,
#tradingTab #twShortEntry,
#tradingTab #twBalancerMargin,
#tradingTab #twBalancerAmount{
    display: block;
    margin-top: 0;
    font-size: 30px !important;
    font-weight: 900 !important;
    line-height: 1.15;
    font-family: Consolas, Monaco, monospace;
    white-space: nowrap;
}

/* LONG */
#tradingTab #twLongEntry{
    color: #22C55E !important;
}

/* MARK */
#tradingTab #twMarkPrice{
    color: #F59E0B !important;
}

/* SHORT */
#tradingTab #twShortEntry{
    color: #EF4444 !important;
}

/* MARGIN */
#tradingTab #twBalancerMargin{
    color: #F8FAFC !important;
}

/* Margin percentage / secondary IDR value */
#tradingTab #twBalancerPercent{
    margin-top: 5px !important;
    color: #9CA3AF !important;
    font-size: 14px !important;
    line-height: 1.2;
}

/*
 * app.js memasukkan nilai IDR sebagai child div
 * di dalam #twBalancerMargin.
 */
#tradingTab #twBalancerMargin > div:first-child{
    font-size: 30px !important;
    font-weight: 900 !important;
    line-height: 1.15;
}

#tradingTab #twBalancerMargin > div:last-child{
    margin-top: 4px;
    color: #9CA3AF !important;
    font-size: 14px !important;
    font-weight: 600;
    line-height: 1.15;
}

/* Recommendation amount */
#tradingTab #twBalancerAmount{
    color: #F8FAFC !important;
}

/* +LONG / +SHORT / NET ZERO */
#tradingTab #twBalancerAction{
    margin-top: 5px !important;
    color: #22C55E !important;
    font-size: 26px !important;
    font-weight: 900 !important;
    line-height: 1.05;
    letter-spacing: .02em;
}

/* Override inline font-size generated by app.js */
#tradingTab #twBalancerAction span{
    font-size: 26px !important;
    font-weight: 900 !important;
}

#tradingTab #twBalancerAction div{
    margin-top: 4px;
    color: #9CA3AF !important;
    font-size: 14px !important;
    font-weight: 600;
    line-height: 1.1;
}

/* SPREAD */
#tradingTab #twPositionSpread{
    display: block;
    margin-top: 0;
    color: #F8FAFC !important;
    font-size: 30px !important;
    font-weight: 900 !important;
    line-height: 1.15;
    font-family: Consolas, Monaco, monospace;
    white-space: nowrap;
}

/* Keep the six metrics visually balanced */
#tradingTab .trading-workspace-status > div:nth-child(1){
    border-left: 3px solid #22C55E;
}

#tradingTab .trading-workspace-status > div:nth-child(2){
    border-left: 3px solid #F59E0B;
}

#tradingTab .trading-workspace-status > div:nth-child(3){
    border-left: 3px solid #EF4444;
}

#tradingTab .trading-workspace-status > div:nth-child(4){
    border-left: 3px solid #64748B;
}

#tradingTab .trading-workspace-status > div:nth-child(5){
    border-left: 3px solid #A855F7;
}

#tradingTab .trading-workspace-status > div:nth-child(6){
    border-left: 3px solid #38BDF8;
}

/* ===========================================================
   RESPONSIVE
=========================================================== */

@media (max-width: 1100px){
    #tradingTab .trading-workspace-status{
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 650px){
    #tradingTab .trading-workspace-status{
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    #tradingTab #twLongEntry,
    #tradingTab #twMarkPrice,
    #tradingTab #twShortEntry,
    #tradingTab #twBalancerMargin,
    #tradingTab #twBalancerAmount,
    #tradingTab #twPositionSpread{
        font-size: 24px !important;
    }

    #tradingTab #twBalancerAction,
    #tradingTab #twBalancerAction span{
        font-size: 22px !important;
    }

    #tradingTab .trading-workspace-status .tw-label{
        font-size: 11px !important;
    }
}


/* ===========================================================
   TRADING WORKSPACE STATUS — PROPORTIONAL WIDTH
   LONG / MARK / SHORT dipadatkan.
   MARGIN / REKOMENDASI diberi ruang lebih besar.
=========================================================== */
#tradingTab .trading-workspace-status{
    grid-template-columns:
        0.8fr
        0.8fr
        0.8fr
        1.5fr
        2fr
        1fr !important;
}

