:root {
    --bg: #f8fafd;
    --sidebar-bg: #ffffff;
    --primary: #00cb81;
    --danger: #e83f4d;
    --gray: #6b778c;
    --border: #e1e4e8;
    --text: #172b4d;
}

* { margin:0; padding:0; box-sizing:border-box; font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

body { background: var(--bg); color: var(--text); display: flex; flex-direction: column; height: 100vh; }

.view-hidden { display: none !important; }

.mobile-refresh-btn { display: none; } /* Hidden on PC — shown in @media mobile */

/* Top Header */
.top-nav { height: 60px; background: #ffffff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 40px; }

.top-nav-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.volatility-alert-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.volatility-alert-controls.is-disabled .volatility-alert-threshold {
    opacity: 0.55;
}

.volatility-alert-threshold {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 32px;
    padding: 0 8px 0 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 11px;
    font-weight: 800;
    color: #1a1a1a;
}

.volatility-alert-threshold input {
    width: 42px;
    border: none;
    background: transparent;
    font-size: 11px;
    font-weight: 800;
    color: inherit;
    text-align: right;
    padding: 0;
    outline: none;
    -moz-appearance: textfield;
}

.volatility-alert-threshold input::-webkit-outer-spin-button,
.volatility-alert-threshold input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.volatility-alert-threshold-suffix {
    color: #6b778c;
    font-size: 10px;
    font-weight: 700;
}

.volatility-alert-controls-mobile {
    width: 100%;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.volatility-alert-controls-mobile .volatility-alert-toggle-group {
    min-width: 88px;
}

.volatility-alert-threshold-mobile {
    flex: 1;
    height: 36px;
}

.volatility-alert-threshold-mobile input {
    width: 100%;
    text-align: left;
    font-size: 12px;
}

.logo { font-weight: 800; color: #1a1a1a; font-size: 20px; display: flex; align-items: center; gap: 8px; letter-spacing: -1px; min-width: 0; }

.status-indicator { font-size: 10px; font-weight: 800; color: #00cb81; margin-left: 10px; white-space: nowrap; }

.nav-links { display: flex; align-items: center; font-size: 13px; font-weight: 600; color: #6b778c; }

.nav-alert-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 0 4px;
    margin-right: 4px;
    border-right: 1px solid var(--border);
    height: 36px;
    flex-shrink: 0;
}

.volatility-alert-toggle-group {
    padding: 2px;
    min-width: 72px;
}

.volatility-alert-toggle-group .toggle-btn {
    flex: 1;
    padding: 6px 10px;
    font-size: 10px;
    min-width: 34px;
}

.nav-links span { cursor: pointer; transition: 0.2s; padding: 20px 15px; display: inline-block; position: relative; }

.nav-links span:hover { color: #1a1a1a; background: rgba(0,0,0,0.02); }

.nav-links .active { color: var(--primary); }
.nav-links .active::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: var(--primary); }

/* Hamburger Menu */
.hamburger { display: none; width: 24px; height: 18px; flex-direction: column; justify-content: space-between; cursor: pointer; transition: all 0.3s ease; z-index: 1001; }

.hamburger span { width: 100%; height: 2px; background: #1a1a1a; border-radius: 2px; transition: all 0.3s ease; }

.hamburger.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }

.hamburger.open span:nth-child(2) { opacity: 0; }

.hamburger.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.btn-quit { background: #e83f4d; color: white; border: none; padding: 8px 16px; border-radius: 6px; font-weight: 700; font-size: 12px; cursor: pointer; }

.app-content { display: flex; flex: 1; overflow: hidden; position: relative; }

.sidebar-overlay { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 998; opacity: 0; transition: opacity 0.3s ease; }

.sidebar-overlay.active { display: block; opacity: 1; }

/* Sidebar */
.sidebar { width: 280px; background: #ffffff; border-right: 1px solid var(--border); padding: 24px; overflow-y: auto; transition: transform 0.3s ease; z-index: 999; }

.mobile-nav-section { display: none; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }

.menu-expander { 
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border-radius: 8px; cursor: pointer;
    background: #f4f5f7; border: 1px solid #e8eaed;
    font-size: 11px; font-weight: 800; color: var(--gray); letter-spacing: 1px;
    text-transform: uppercase; user-select: none;
}

.menu-expander:active { background: #eaecef; }

.menu-list { 
    display: none; flex-direction: column; gap: 0;
    margin-top: 6px; overflow: hidden;
    border: 1px solid #f0f0f0; border-radius: 8px;
}

.menu-list.active { display: flex; }

.m-nav-item { 
    font-size: 12px; font-weight: 700; color: var(--gray); cursor: pointer;
    padding: 10px 14px;
    border-bottom: 1px solid #f4f5f7;
    transition: background 0.15s, color 0.15s;
    display: block;
}

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

.m-nav-item:hover, .m-nav-item:active { background: #f0fdfa; color: var(--primary); }

.m-nav-item.active { color: var(--primary); background: #f0fdfa; font-weight: 800; }

.status-dot { color: #00cb81; font-weight: 700; font-size: 12px; display: flex; align-items: center; gap: 6px; margin-bottom: 30px; }

.price-blue { color: #40a9ff; font-weight: 700; font-size: 14px; margin-top: 10px; }

.form-label { font-size: 11px; font-weight: 600; color: var(--gray); margin-bottom: 8px; display: block; margin-top: 20px; }

.slot-budget-hint {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 16px;
    line-height: 1.4;
    min-height: 16px;
}

.toggle-group { display: flex; background: #f4f5f7; border-radius: 6px; padding: 3px; }

.toggle-btn { flex: 1; border: none; padding: 8px; border-radius: 4px; font-size: 11px; font-weight: 700; cursor: pointer; background: transparent; color: var(--gray); }

.toggle-btn.active { background: #ffffff; color: #172b4d; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

.slider-wrap { margin-top: 30px; position: relative; }

.slider-val { position: absolute; top: -25px; right: 0; font-size: 13px; font-weight: 800; color: var(--primary); }

/* 🎨 Custom Lever Slider (pixel-perfect, no browser quirks) */
.lev-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: #e9ecf0;
    border-radius: 2px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.lev-fill {
    position: absolute;
    left: 0;          /* always flush to left edge */
    top: 0;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    pointer-events: none;
    transition: width 0.05s linear;
}

.lev-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    transition: left 0.05s linear, box-shadow 0.15s;
    pointer-events: none;
}

.lev-track:active .lev-thumb,
.lev-thumb.dragging { cursor: grabbing; box-shadow: 0 0 0 6px rgba(0,161,156,0.2); }

/* 특이도를 올리지 말 것. input:not([type=…]) 연쇄는 OKX/로그인/Bono 다크 입력을 덮어
   흰 배경+흰 글자가 된다. 체크박스·라디오는 아래 별도 리셋. */
input, select { 
    width: 100%; 
    border: 1px solid var(--border); 
    padding: 0 10px; 
    height: 36px;
    border-radius: 6px; 
    font-size: 12px; 
    font-weight: 600; 
    outline: none; 
    box-sizing: border-box;
    display: block;
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    height: auto;
    padding: 0;
    display: inline-block;
    appearance: auto;
    -webkit-appearance: auto;
    background-color: transparent;
    border: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b778c' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

/* --- Premium Search UI (v3.5) --- */
.search-container { position: relative; margin-bottom: 8px; }

#symbolSearch {
    padding-left: 32px;
    background: #f4f5f7;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 11px;
}

#symbolSearch:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 161, 156, 0.1);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.5;
    pointer-events: none;
}

/* Main Context */
.main-view { flex: 1; padding: 40px; overflow-y: auto; }

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

.header-title-wrap { display: flex; flex-direction: row; align-items: center; gap: 12px; }

.symbol-name { font-size: 24px; font-weight: 800; margin-top: 5px; }

.header-stats { display: flex; gap: 60px; transition: all 0.3s ease; }

.stat-item { text-align: right; }

.stat-lbl { font-size: 10px; font-weight: 700; color: var(--gray); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.stat-val { font-size: 18px; font-weight: 800; display: block; font-variant-numeric: tabular-nums; }

.stat-val.blue { color: var(--primary); }

/* Card Panels */
.card { background: #ffffff; border-radius: 8px; border: 1px solid var(--border); padding: 24px; margin-bottom: 24px; }

.card-title { font-size: 14px; font-weight: 700; margin-bottom: 20px; }

.btn-teal, .btn-red, .btn-gray { 
    height: 36px;
    width: 130px;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-teal { background: var(--primary); color: white; }

.btn-red { background: #e83f4d; color: white; }

.btn-gray { background: #9299a8; color: white; }

.action-card { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; }

.action-container { display: flex; gap: 12px; }

/* Simulation Table */
.sim-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.safe-badge { background: #e3f9f5; color: var(--primary); font-size: 9px; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-left: 10px; }

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

th { text-align: left; padding: 12px; font-size: 10px; font-weight: 700; color: var(--gray); border-bottom: 1px solid var(--border); }

td { padding: 14px 12px; font-size: 12px; font-weight: 600; border-bottom: 1px solid #f4f5f7; }

.status-ready { color: #6b778c; }

.status-planned { color: #94a3b8; font-style: italic; }

.status-waiting { color: #f59e0b; }

.grid-deploy-banner {
    margin: 10px 0 4px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.45;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

.status-active { color: var(--primary); }

.status-too-small { color: #e83f4d; font-weight: 800; }

.btn-max {
    background: #e3f9f5;
    color: #007979;
    border: none;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-max:hover {
    background: #007979;
    color: white;
}

#simTable {
    width: 100%;
    min-width: unset; /* Let it shrink if needed */
    border-collapse: collapse;
    font-size: 11px;
    table-layout: fixed;
    font-family: 'Courier New', Courier, monospace; /* Monospace for zero jitter */
}

#simTable th, #simTable td {
    padding: 10px 8px;
    border-bottom: 1px solid #f1f3f5;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip; /* Don't even show ellipsis to prevent shifts */
    box-sizing: border-box;
}

/* Absolute Pixel Locking with max/min constraints */
#simTable th:nth-child(1), #simTable td:nth-child(1) { width: 8%; text-align: center; }
#simTable th:nth-child(2), #simTable td:nth-child(2) { width: 18%; text-align: center; }
#simTable th:nth-child(3), #simTable td:nth-child(3) { width: 18%; text-align: center; }
#simTable th:nth-child(4), #simTable td:nth-child(4) { width: 18%; text-align: center; }
#simTable th:nth-child(5), #simTable td:nth-child(5) { width: 18%; text-align: center; letter-spacing: -1px; }
#simTable th:nth-child(6), #simTable td:nth-child(6) { width: 20%; text-align: center; }

.sim-container {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-x: auto; /* Enable scroll if narrow */
}

/* --- Premium Report Styles --- */
.report-roi-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 950;
    font-size: 11px;
    display: inline-block;
    letter-spacing: -0.3px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}

.step-badge {
    background: #f0f2f5;
    color: var(--text);
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 10px;
}

/* --- Unified Report 2.0 System --- */

#reportTable th {
    background: #fbfbfc;
    padding: 16px 12px;
    border-bottom: 2px solid var(--border);
}

#reportTable td {
    padding: 16px 12px;
    border-bottom: 1px solid #f4f5f7;
    vertical-align: middle;
}

.nav-links span {
    cursor: pointer;
    transition: color 0.2s;
}

.nav-links span:hover {
    color: var(--primary);
}

.nav-links span.active {
    color: var(--primary);
}

/* --- Simulation Status UI --- */
.frozen-badge {
    background: rgba(100, 181, 246, 0.15);
    color: #64b5f6;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid rgba(100, 181, 246, 0.3);
    text-shadow: 0 0 10px rgba(100, 181, 246, 0.5);
    animation: pulse-blue 2s infinite;
    display: inline-block;
    margin-bottom: 5px;
}

@keyframes pulse-blue {
    0% { opacity: 0.8; }

    50% { opacity: 1; }

    100% { opacity: 0.8; }

}

.warning-banner {
    background: rgba(232, 63, 77, 0.1);
    color: #e83f4d;
    padding: 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 10px;
    border: 1px dashed rgba(232, 63, 77, 0.4);
    text-align: center;
}

/* --- Portfolio Overview (v3.0) --- */
.portfolio-container {
    display: flex;
    gap: 12px;
    padding: 0 0 24px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.portfolio-container::-webkit-scrollbar { display: none; }

.portfolio-card {
    position: relative;
    min-width: 140px;
    padding: 15px;
    background: #ffffff; /* Use solid white for better contrast */
    border: 1px solid var(--border); /* Gray line for unselected tabs */
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    height: 90px;
}
.portfolio-card * { pointer-events: none; }
.portfolio-card .close-tab { pointer-events: auto; }

.portfolio-card.active {
    border: 2px solid var(--primary);
    background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
    box-shadow: 0 4px 15px rgba(0, 161, 156, 0.1);
}

.portfolio-card.idle-slot {
    opacity: 0.72;
}

.portfolio-card.idle-slot .p-roi,
.portfolio-card.idle-slot .p-pnl {
    color: #94a3b8;
}

.close-tab {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.15); /* Darker background for visibility */
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    cursor: pointer;
    line-height: 1;
}

.close-tab:hover {
    background: #e83f4d;
    color: #ffffff;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 10px rgba(232, 63, 77, 0.4);
}

.portfolio-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-color: var(--primary);
}

/* Duplicate .portfolio-card.active removed and consolidated above */
.p-symbol { font-size: 10px; font-weight: 900; color: var(--gray); text-transform: uppercase; letter-spacing: 1px; }
#meritzPortfolio .p-symbol { font-size: 14px; letter-spacing: 0; text-transform: none; }

.meritz-top {
    display: flex;
    align-items: center;
    gap: 20px;
}
.meritz-top .portfolio-container {
    flex: 1;
    min-width: 0;
}
.meritz-indices {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: stretch;
    margin: 0 0 24px 0;
}
.meritz-index {
    min-width: 220px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.meritz-index-top { justify-content: flex-end; }
.meritz-flows { justify-items: end; }
.meritz-index-top { display: flex; align-items: center; gap: 10px; }
.meritz-index-name { font-size: 12px; color: var(--gray); font-weight: 700; }
.meritz-index-price { font-size: 22px; font-weight: 800; color: #2f6bff; line-height: 1.15; }
.meritz-index-chg { font-size: 13px; font-weight: 800; }
.meritz-index-chg.up { color: var(--red); }
.meritz-index-chg.down { color: #2f6bff; }
.meritz-flows { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.meritz-flows span { display: block; font-size: 11px; color: var(--gray); }
.meritz-flows b { font-size: 13px; }
.meritz-flows b.up { color: var(--red); }
.meritz-flows b.down { color: #2f6bff; }

.p-side {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.4px;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 4px;
    vertical-align: middle;
}
.p-side.long { color: var(--primary); background: rgba(0, 203, 129, 0.12); }
.p-side.short { color: var(--danger); background: rgba(232, 63, 77, 0.12); }

.p-roi { font-size: 18px; font-weight: 900; color: #1a1a1a; margin: 4px 0; }

.p-pnl { font-size: 11px; font-weight: 700; color: var(--gray); }

.portfolio-card.danger { border-color: var(--danger); background: #fffcfc; }

.portfolio-card.danger .p-roi { color: var(--danger); }

/* Sidebar Section Headers */
.sidebar-section-title {
    font-size: 10px;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 30px;
    margin-bottom: 12px;
    border-bottom: 1px solid #f0f2f5;
    padding-bottom: 8px;
}

/* --- MOBILE APP UI DESIGN (UHD AESTHETICS & JITTER-FREE) --- */
@media (max-width: 768px) {
    .darkModeBtn { display: none !important; }
    .desktop-only { display: none !important; }
    /* 🚀 v10.6 App-Grade Precision & Margins */
    html, body { 
        height: 100dvh; 
        overflow: hidden;
        overflow-x: hidden !important;
        position: fixed; 
        width: 100%; 
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    
    body { 
        background: #000; 
        display: flex; 
        flex-direction: column; 
    }

    /* Top Nav: Matte Black Pro */
    .top-nav { 
        height: 52px; 
        background: #000; 
        padding: 0 16px; 
        border-bottom: 1px solid rgba(255,255,255,0.1);
        z-index: 1000;
    }

    .hamburger { display: flex; width: 22px; height: 16px; flex-shrink: 0; }

    .hamburger span { background: #fff; height: 2px; }

    .top-nav-left { gap: 8px; z-index: 1001; }

    .volatility-alert-threshold {
        height: 28px;
        padding: 0 6px;
        border-color: rgba(255,255,255,0.18);
        background: rgba(255,255,255,0.06);
        color: #fff;
    }

    .volatility-alert-threshold input { width: 36px; color: #fff; }

    .volatility-alert-threshold-suffix { color: rgba(255,255,255,0.65); }

    .volatility-alert-toggle-group {
        background: rgba(255,255,255,0.08);
    }

    .volatility-alert-toggle-group .toggle-btn {
        color: rgba(255,255,255,0.55);
    }

    .volatility-alert-toggle-group .toggle-btn.active {
        background: rgba(0, 203, 129, 0.22);
        color: #6dffb8;
        box-shadow: none;
    }

    
    .logo { 
        position: absolute; left: 50%; transform: translateX(-50%); 
        font-size: 15px; font-weight: 800; color: #fff; letter-spacing: -0.5px; 
    }

    /* Hide top nav links on mobile — they live in the sidebar */
    .nav-links { display: none !important; }

    /* Show the mobile nav section inside sidebar */
    .mobile-nav-section { 
        display: block !important; 
        margin-bottom: 0; 
        padding-bottom: 16px; 
        border-bottom: 1px solid #f1f5f9;
        margin-bottom: 20px;
    }

    /* Sidebar on mobile: full-height drawer */
    .sidebar {
        position: fixed;
        left: -300px; top: 0;
        width: 300px; height: 100dvh;
        background: #fff; z-index: 2000;
        padding: 64px 16px 32px 16px;
        transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
        overflow-y: auto;
        border-right: none;
    }

    .sidebar.active { transform: translateX(300px); box-shadow: 40px 0 80px rgba(0,0,0,0.3); }

    .app-content { 
        flex: 1; background: #f8fafc; overflow-y: auto; 
        overflow-x: hidden !important;
        border-radius: 12px 12px 0 0; margin-top: -8px;
        max-width: 100%;
        overscroll-behavior-y: contain; /* 🛡️ Prevent native Safari bounce */
    }

    /* 🛡️ Global Margin Guard: Professional App Spacing */
    .main-view { padding: 16px 16px 40px 16px; overflow-x: hidden; max-width: 100%; }

    /* Common: main-header layout for both Bybit & OKX on mobile */
    .main-header { padding: 12px 0 0 0; display: block !important; }

    .main-header > div:last-child { margin-left: 0 !important; width: 100% !important; padding: 0 !important; }

    /* ===== BYBIT ONLY: Stats Strip (Live Price / ACT.MARGIN / Balance / Live ROI) ===== */
    /* Scoped to #dashboardView — does NOT affect OKX */
    #dashboardView .header-stats { 
        display: grid !important; 
        grid-template-columns: 1fr 1fr !important; 
        background: #fff; 
        border: 1px solid #edf2f7; 
        border-radius: 12px;
        margin-top: 8px; 
        margin-bottom: 20px;
        width: 100% !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    }

    #dashboardView .stat-item { 
        padding: 14px 0 !important; 
        border-right: 1px solid #f1f5f9; 
        border-bottom: 1px solid #f1f5f9;
        text-align: center;
    }

    #dashboardView .stat-item:nth-child(2n) { border-right: none; }

    #dashboardView .stat-item:nth-child(3),
    #dashboardView .stat-item:nth-child(4) { border-bottom: none; }

    #dashboardView .stat-lbl { font-size: 9px; font-weight: 800; color: #94a3b8; margin-bottom: 4px; display: block; text-transform: uppercase; letter-spacing: 0.3px; }

    #dashboardView .stat-val { font-size: 14px; font-weight: 900; color: #0f172a; }

    /* Portfolio Section: 2-Column Balanced Grid */
    .symbol-name { display: none !important; }

    .portfolio-container { 
        display: grid !important; grid-template-columns: 1fr 1fr !important;
        gap: 12px !important; padding: 0 0 24px 0 !important; 
    }

    .portfolio-card { 
        min-height: 110px !important; padding: 16px !important; border-radius: 14px !important;
        background: #fff !important; border: 1px solid #ebeef2 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.03) !important;
    }

    .portfolio-card.active { border: 2.5px solid var(--primary) !important; background: #f0fdfa !important; }

    
    /* TOTAL PORTFOLIO: Light Theme (Matches Screenshot) */
    .portfolio-card:first-child { 
        grid-column: 1 / span 2 !important; 
        background: #ffffff !important;
        border: 1px solid #ebeef2 !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.03) !important;
    }

    .portfolio-card:first-child .p-symbol { color: #64748b; font-size: 13px; font-weight: 800; text-transform: uppercase; }

    .portfolio-card:first-child .p-roi { font-size: 32px !important; color: var(--primary) !important; font-weight: 800; margin-top: 8px; }

    .portfolio-card:first-child .p-pnl { color: #64748b !important; font-size: 14px; font-weight: 700; margin-top: 4px; }

    /* Action Deck */
    .action-card { padding: 0 0 24px 0 !important; display: block !important; border: none !important; background: transparent !important; }

    
    /* ===== Simulation Table Mobile: STEP | PRICE | PNL(ROI) | STATUS ===== */
    /* Hide LIQ PRICE (col 3) and CUM MARGIN (col 4) */
    #simTable th.col-liq,
    #simTable th.col-cum { display: none !important; }

    #simTable td.col-liq,
    #simTable td.col-cum { display: none !important; }

    /* Override PC min-width so table fits mobile screen */
    #simTable { min-width: 0 !important; width: 100% !important; table-layout: fixed !important; font-size: 11px !important; }

    /* Column widths: STEP(26) | PRICE(auto) | PNL ROI(auto) | STATUS(72px with TP button) */
    #simTable th:nth-child(1), #simTable td:nth-child(1) { width: 26px !important; min-width: 26px !important; max-width: 26px !important; text-align: center !important; padding: 8px 2px !important; }

    #simTable th:nth-child(2), #simTable td:nth-child(2) { width: 105px !important; min-width: 90px !important; max-width: 110px !important; padding-left: 4px !important; }

    #simTable th:nth-child(5), #simTable td:nth-child(5) { width: auto !important; min-width: 70px !important; text-align: right !important; padding-right: 2px !important; font-size: 10px !important; }

    #simTable th:nth-child(6), #simTable td:nth-child(6) { width: auto !important; min-width: 0 !important; max-width: none !important; text-align: right !important; padding-right: 6px !important; font-size: 10px !important; white-space: nowrap !important; }

    .action-container { display: flex; gap: 10px; }

    .btn-teal, .btn-red { flex: 1; height: 54px; border-radius: 14px; font-size: 14px; font-weight: 800; }

    /* Report View Specific Fixes */
    .report-header { flex-direction: column; align-items: stretch !important; gap: 8px; padding: 16px 0 0 0; margin-bottom: 0 !important; }

    .report-header h2 { font-size: 20px !important; letter-spacing: -0.5px; }

    .report-filters { 
        width: 100%; display: flex !important; flex-direction: row !important; 
        align-items: center !important; gap: 8px !important;
    }

    .report-filters input { flex: 1.2 !important; height: 38px !important; background: #fff !important; padding: 0 10px !important; }

    .report-filters .btn { 
        flex: 1 !important; height: 38px !important; 
        font-size: 10px !important; padding: 0 8px !important;
        white-space: normal; line-height: 1.2;
    }

    /* Report Stats Grid: Forced 2x2 */
    .report-stats-grid { 
        grid-template-columns: 1fr 1fr !important; gap: 8px !important; margin-bottom: 16px; 
    }

    .report-stat-card { padding: 16px !important; min-height: 100px; justify-content: center; }

    .report-stat-card .val { font-size: 18px !important; word-break: break-all; }

    /* Simulation Table Fix */
    .card:last-child { border-radius: 16px; padding: 24px 12px; margin-top: 8px; border: 1px solid #edf2f7; background: #fff; overflow: hidden; }

    .sim-header { padding: 0 0 16px 0; }

    /* 📱 Mobile Refresh Button */
    .mobile-refresh-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        background: rgba(255,255,255,0.12);
        border: 1px solid rgba(255,255,255,0.2);
        border-radius: 50%;
        color: #fff;
        font-size: 18px;
        cursor: pointer;
        flex-shrink: 0;
        transition: background 0.2s, transform 0.3s;
    }

    .mobile-refresh-btn:active {
        background: rgba(0, 203, 129, 0.3);
        transform: rotate(180deg);
    }

    /* 📊 Trade History Table: 5-column balance for Mobile */
    #reportTable th:nth-child(1), #reportTable td:nth-child(1) { width: 35px !important; }

    #reportTable th:nth-child(2), #reportTable td:nth-child(2) { width: 75px !important; }

    #reportTable th:nth-child(5), #reportTable td:nth-child(5) { width: 50px !important; text-align: center !important; padding-right: 0 !important; }

    #reportTable th:nth-child(6), #reportTable td:nth-child(6) { width: 60px !important; text-align: right !important; }

    #reportTable th:nth-child(7), #reportTable td:nth-child(7) { width: 70px !important; text-align: right !important; display: table-cell !important; }

    #reportTable th:nth-child(8), #reportTable td:nth-child(8) { width: 65px !important; text-align: right !important; padding-right: 8px !important; display: table-cell !important; }

    #reportTable { width: 100% !important; table-layout: fixed !important; }

    #reportTable td { font-size: 11px; }

    .sidebar-overlay { backdrop-filter: blur(5px); background: rgba(0,0,0,0.5); position: fixed; top: 0; left: 0; width: 100%; height: 100%; }

    /* Mobile chart default height (Bybit only — OKX is in okx_style.css) */
    #dashboardView #tvChart {
        height: min(40dvh, 280px) !important;
        min-height: 200px;
        touch-action: none;
    }

}

#dashboardView #tvChart {
    touch-action: none;
}

/* --- Flash Guard Premium UI (v1.0) --- */
.flash-guard-section {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-top: 24px;
    transition: all 0.3s ease;
}

.flash-guard-section.active {
    border-color: var(--primary);
    background: rgba(0, 161, 156, 0.03);
    box-shadow: 0 4px 15px rgba(0, 161, 156, 0.08);
}

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

.flash-title {
    font-size: 11px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.flash-title i { color: gold; font-style: normal; }

/* iOS Style Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

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

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

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

input:checked + .slider-toggle { background-color: var(--primary); }

input:checked + .slider-toggle:before { transform: translateX(14px); }

.flash-input-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.flash-input-wrap input {
    width: 80px;
    height: 30px;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
}

.flash-hint {
    font-size: 9px;
    color: var(--gray);
    margin-top: 10px;
    line-height: 1.4;
}

.price-song-alert {
    margin-top: 16px;
}

.price-song-alert .flash-input-wrap input {
    width: 100%;
    max-width: 140px;
}

.price-song-alert-coin {
    font-size: 9px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0;
}

.price-song-alert-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    font-size: 10px;
    font-weight: 700;
    color: var(--gray);
}

.price-song-alert-file input {
    width: 140px;
    font-size: 10px;
}

.price-song-alert-status {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 8px;
    min-height: 14px;
}

/* --- Flash Guard Premium Monitoring Pulse --- */
.monitoring-pulse {
    display: none; /* Hidden by default, shown by JS when active */
    width: 8px;
    height: 8px;
    background-color: #00ffd5; /* High-intensity cyan */
    border-radius: 50%;
    margin-right: 8px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 5px rgba(0, 255, 213, 0.2);
}

.monitoring-pulse.pulse-active {
    animation: flash-monitoring-hit 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- BYBIT Top Nav Flash Guard Alert (Clean & Icon-free) --- */
.hamburger.nav-flash-alert span {
    background: #ff334b !important;
    animation: nav-flash-blink 0.8s ease-in-out infinite alternate !important;
}

#currentExchangeLabel.nav-flash-alert {
    color: #ff334b !important;
    animation: nav-flash-blink 0.8s ease-in-out infinite alternate !important;
}

#nav-bybit.nav-flash-alert,
.nav-links span.nav-flash-alert {
    color: #ff334b !important;
    animation: nav-flash-blink 0.8s ease-in-out infinite alternate !important;
    text-shadow: 0 0 8px rgba(255, 51, 75, 0.45);
}

.m-nav-item.nav-flash-alert {
    color: #ff334b !important;
    animation: nav-flash-blink 0.8s ease-in-out infinite alternate !important;
}

@keyframes nav-flash-blink {
    0% {
        opacity: 1;
        text-shadow: 0 0 8px rgba(255, 51, 75, 0.8);
    }
    100% {
        opacity: 0.3;
        text-shadow: none;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

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

.modal-header h3 { font-size: 16px; font-weight: 800; color: var(--text); }

.modal-close {
    background: none; border: none; font-size: 24px; color: var(--gray); cursor: pointer;
}

.modal-body { padding: 24px; overflow-y: auto; }

/* Stats Grid & Cards */
.report-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.report-stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.report-stat-card .lbl { font-size: 10px; font-weight: 800; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; }

.report-stat-card .val { font-size: 22px; font-weight: 900; color: var(--text); }

/* Clickable Stats Card */
.clickable-card { cursor: pointer; }

.clickable-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.clickable-card .lbl { color: var(--primary); }

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

.m-stat {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
}

.m-stat .lbl { font-size: 9px; font-weight: 800; color: var(--gray); display: block; margin-bottom: 4px; }

.m-stat .val { font-size: 14px; font-weight: 900; color: var(--text); }

.modal-table-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }

.modal-table-wrap table { font-size: 11px; }

.modal-table-wrap th { background: #fbfbfc; padding: 10px; }

.modal-table-wrap td { padding: 10px; }

/* Misc Report Styles */
.report-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 20px; }

.report-filters { display: flex; gap: 10px; align-items: center; }

.report-filters input { 
    background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; 
    padding: 8px 12px; font-size: 13px; outline: none; width: 220px;
}

#reportTable tbody tr { cursor: pointer; transition: background 0.2s; }

#reportTable tbody tr:hover { background: #f8fafc; }

/* --- Database Explorer (Sequel Ace Style) --- */
.db-explorer {
    display: flex;
    height: calc(100vh - 140px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.db-sidebar {
    width: 240px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: #fbfbfc;
}

.db-sidebar-header {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.db-sidebar-header select {
    background-color: #f1f3f5;
    height: 30px;
    font-size: 11px;
}

.db-table-list {
    list-style: none;
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
}

.db-table-list li {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.1s;
}

.db-table-list li:hover {
    background: #eff1f3;
}

.db-table-list li.active {
    background: var(--primary);
    color: #fff;
}

.db-table-list li.active svg {
    color: #fff;
}

.db-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.db-content-header {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.db-breadcrumb {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray);
}

.db-breadcrumb .db-sep {
    margin: 0 8px;
    opacity: 0.4;
}

.db-breadcrumb .active {
    color: var(--text);
}

.db-actions .btn-refresh {
    background: #f1f3f5;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray);
}

.db-actions .btn-refresh:hover {
    background: #e9ecef;
    color: var(--text);
}

.db-grid-container {
    flex: 1;
    overflow: auto;
    position: relative;
}

.db-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: 'Inter', monospace; /* Monospace is better for data grids */
    font-size: 11px;
}

.db-grid th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid #eee;
    z-index: 10;
}

.db-grid th .col-name {
    color: var(--text);
    font-weight: 800;
}

.db-grid th .col-type {
    font-size: 9px;
    color: var(--gray);
    font-weight: normal;
    text-transform: uppercase;
}

.db-grid td {
    padding: 6px 12px;
    border-bottom: 1px solid #f1f3f5;
    border-right: 1px solid #eeeff1;
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #444;
}

.db-grid tr:hover td {
    background: #f4f7fa;
}

.db-grid td.val-null {
    color: #ccc;
    font-style: italic;
}

.db-inline-edit {
    width: 100%;
    height: 24px;
    padding: 2px 4px;
    border: 2px solid var(--primary);
    border-radius: 2px;
    font-size: 11px;
    font-family: inherit;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 161, 156, 0.2);
}

.db-row-actions {
    width: 30px;
    padding: 0 !important;
    text-align: center !important;
    vertical-align: middle;
}

.btn-delete-row {
    background: none;
    border: none;
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.db-grid tr:hover .btn-delete-row {
    color: var(--danger);
}

.db-empty-state, .db-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray);
}

.db-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.2;
}

@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .db-explorer {
        flex-direction: column;
        height: calc(100vh - 120px);
    }

    .db-sidebar {
        width: 100%;
        height: 150px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

}

@keyframes pulse-deploy {
    0% { opacity: 0.9; }

    50% { opacity: 1; filter: brightness(1.2); }

    100% { opacity: 0.9; }

}

.deploying-active {
    animation: pulse-deploy 1s infinite ease-in-out;
}

/* ─── Chart Resize Handle ─────────────────────────────── */
.chart-resize-handle {
    height: 8px;
    background: #f4f5f7;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-bottom: 20px;   /* replaces card margin-bottom */
    user-select: none;
    -webkit-user-select: none;
}

.chart-resize-handle:hover,
.chart-resize-handle.dragging {
    background: #e3f9f5;
}

.chart-resize-handle .resize-grip {
    width: 40px;
    height: 3px;
    background: #c1c7d0;
    border-radius: 2px;
    transition: background 0.2s;
}

.chart-resize-handle:hover .resize-grip,
.chart-resize-handle.dragging .resize-grip {
    background: var(--primary);
}

/* ─── Chart Range Buttons ─────────────────────────────── */
.range-btn {
    padding: 4px 7px;
    font-size: 10px;
    font-weight: 700;
    height: auto;
    min-height: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    color: var(--gray);
    transition: 0.15s;
}

.range-btn.active {
    background: #ffffff;
    color: #172b4d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* ─── Chart Loading Overlay ───────────────────────────── */
.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(2px);
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    gap: 8px;
    z-index: 10;
    border-radius: 4px;
    pointer-events: none;
}

