/* ============================================================

/* ── Card theme accent (set by bot_balance.js via inline style) ── */
:root { --accent: #10b981; }

   Futures Demo — Global Stylesheet
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ---------- Base ---------- */
body {
    background: #060912;
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    display: flex;
    justify-content: center;
    padding-bottom: 80px;
    min-height: 100vh;
}

/* ---------- Page wrapper ---------- */
.page-wrapper {
    max-width: 430px;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
    background: #0a0f1e;
}

.page-content {
    padding-top: 70px;
    padding-bottom: 80px;
    padding-left: 16px;
    padding-right: 16px;
}

.content-container {
    max-width: 100%;
    margin: 0 auto;
}

/* ---------- Top Bar ---------- */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: #0a0f1e;
    border-bottom: 1px solid #2a2e45;
    z-index: 900;
    max-width: 430px;
    margin: 0 auto;
}
.top-bar .app-title { font-size: 1rem; font-weight: 700; color: #e2e8f0; flex: 1; text-align: center; }
.hamburger { font-size: 28px; background: none; border: none; color: white; cursor: pointer; margin-right: 16px; line-height: 1; padding: 4px; }
.app-title { font-size: 1.2rem; font-weight: 600; color: #3b82f6; white-space: nowrap; }

#headerContainer {
    max-width: 430px;
    margin: 0 auto;
    position: relative;
    z-index: 1001;
}

/* ---------- Drawer ---------- */
.drawer { position: fixed; top: 0; left: -280px; width: 260px; height: 100%; background: #131625; border-right: 1px solid #2a2e45; transition: left 0.3s ease; z-index: 1000; padding-top: 60px; box-shadow: 2px 0 12px rgba(0,0,0,0.5); }
.drawer.open { left: 0; }
.drawer-item { padding: 16px 24px; color: #e2e8f0; font-size: 1rem; font-weight: 500; border-bottom: 1px solid #2a2e45; cursor: pointer; transition: background 0.15s; }
.drawer-item:hover { background: #1e293b; }
.drawer-item.logout { color: #ef4444; }
.drawer-item.active { background: #1e293b; border-left: 3px solid #3b82f6; }
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; display: none; }
.overlay.show { display: block; }

/* ---------- Cards ---------- */
.card { background: #131625; border-radius: 20px; padding: 18px; margin-bottom: 16px; border: 1px solid #2a2e45; }
.card-title { font-size: 1.1rem; font-weight: 700; color: #38bdf8; margin-bottom: 16px; }

/* ---------- Balance Card ---------- */
.balance-card {
    background: linear-gradient(135deg, #1e293b, #0f1222);
    border-radius: 24px;
    padding: 18px 20px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #3b82f6;
}
.balance-label { font-size: 0.78rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.balance-amount { font-size: 2rem; font-weight: 800; color: #3b82f6; margin: 6px 0 4px; }
.balance-effective-row { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 4px 0 6px; font-size: 0.85rem; }
.balance-effective-label { color: #64748b; }
.balance-effective-value { font-weight: 700; }
.balance-detail-row { display: flex; justify-content: center; gap: 14px; font-size: 0.78rem; color: #64748b; flex-wrap: wrap; }
.pnl { font-size: 0.9rem; color: #94a3b8; }
.pnl-value.positive { color: #10b981; font-weight: 600; }
.pnl-value.negative { color: #ef4444; font-weight: 600; }

/* ---------- Form Elements ---------- */
input, select {
    width: 100%;
    padding: 12px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 1rem;
    margin-bottom: 12px;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
}
input:focus, select:focus { outline: none; border-color: #3b82f6; }

/* Custom dropdown arrow — replaces the native one removed by appearance:none */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}
select:focus { border-color: #3b82f6; }

/* Ensure options are readable on all browsers/platforms */
select option {
    background: #1e293b;
    color: #e2e8f0;
    padding: 8px 12px;
}

/* ---------- Buttons ---------- */
.btn { padding: 12px; border-radius: 50px; font-weight: 800; border: none; cursor: pointer; transition: opacity 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-long  { background: linear-gradient(135deg, #059669, #10b981); color: #fff; flex: 1; }
.btn-short { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; flex: 1; }
.btn-close { background: #475569; color: white; flex: 1; }
.btn-primary { background: #3b82f6; color: white; }
.btn-secondary { background: #334155; color: white; }
.btn-danger { background: #ef4444; color: white; }
.buttonsetting { background: #3b82f6; color: white; border: none; padding: 12px; border-radius: 40px; font-weight: bold; font-size: 0.95rem; cursor: pointer; width: 100%; margin-top: 8px; transition: opacity 0.15s; }
.buttonsetting:hover { opacity: 0.9; }
.buttonsetting.btn-secondary { background: #334155; }
.buttonsetting.btn-danger    { background: #ef4444; }

/* ---------- Footer ---------- */
.bottom-footer { position: fixed; bottom: 0; left: 0; right: 0; max-width: 430px; margin: 0 auto; display: flex; gap: 12px; padding: 12px 16px; background: #131625; border-top: 1px solid #2a2e45; z-index: 100; }
.footer-btn { flex: 1; padding: 12px; background: #1e293b; border: none; border-radius: 14px; color: #94a3b8; font-weight: 600; cursor: pointer; }
.footer-btn.active { background: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Mode Toggle ---------- */
.mode-toggle { display: flex; gap: 0; margin-bottom: 20px; background: #0f1222; border-radius: 14px; padding: 4px; }
.mode-btn { flex: 1; padding: 10px; background: transparent; border: none; border-radius: 10px; color: #64748b; font-weight: 600; font-size: 0.88rem; cursor: pointer; transition: all 0.2s; }
.mode-btn.active { background: #2563eb; color: white; box-shadow: 0 2px 8px rgba(37,99,235,0.4); }

/* ---------- Fields ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.8rem; color: #94a3b8; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.field input, .field select { margin-bottom: 0; }

/* ---------- Leverage Row ---------- */
.lev-row { display: flex; align-items: center; gap: 12px; }
.lev-row input[type="range"] { flex: 1; height: 4px; accent-color: #3b82f6; }
.lev-badge { background: #3b82f6; padding: 8px 12px; border-radius: 12px; font-weight: 700; font-size: 0.9rem; min-width: 48px; text-align: center; }

/* ---------- Preview Grid ---------- */
.preview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; background: #0f1222; border-radius: 16px; padding: 14px; margin: 14px 0; border: 1px solid #1e293b; }
.pv-item { text-align: center; padding: 6px 0; }
.pv-label { font-size: 0.68rem; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; }
.pv-value { font-size: 0.95rem; font-weight: 600; color: #cbd5e1; margin-top: 4px; }
.action-row { display: flex; gap: 12px; margin-top: 16px; }

/* ---------- Position Cards ---------- */
.pos-card { background: #1e293b; border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.pos-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.pos-header-left { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; overflow: hidden; }
.pos-pair { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.pos-type { padding: 2px 8px; border-radius: 8px; font-size: 0.7rem; font-weight: 700; margin-left: 8px; flex-shrink: 0; }
.pos-type.long  { background: #10b981; color: white; }
.pos-type.short { background: #ef4444; color: white; }
.long  { background: #0f3b2c; color: #10b981; }
.short { background: #3b1e1e; color: #ef4444; }
.close-btn { background: #ef4444; border: none; padding: 6px 12px; border-radius: 10px; color: white; cursor: pointer; font-size: 0.8rem; flex-shrink: 0; }
.close-btn:hover { opacity: 0.85; }
.edit-icon, .graph-icon { background: none; border: none; color: #38bdf8; font-size: 1.1rem; cursor: pointer; margin-left: 6px; padding: 2px 4px; border-radius: 6px; transition: background 0.15s; }
.edit-icon:hover, .graph-icon:hover { background: rgba(56,189,248,0.12); }
.auto-rule { font-size: 0.7rem; margin-top: 6px; color: #f59e0b; background: #1a1a2e; padding: 4px 8px; border-radius: 20px; display: inline-block; }
.liq-info { font-size: 0.7rem; color: #f59e0b; margin-top: 6px; }
.transaction-item { padding: 8px; border-bottom: 1px solid #2a2e45; font-size: 0.85rem; }
.transaction-item:last-child { border-bottom: none; }

/* ---------- Modals ---------- */
.modal, .confirm-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 16px;
}
.modal.open, .confirm-modal.open { display: flex; }
.modal-content {
    background: #131625;
    border-radius: 24px;
    max-width: 90%;
    width: 700px;
    max-height: 80vh;
    overflow: auto;
    padding: 20px;
    border: 1px solid #3b82f6;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #2a2e45; }
.modal-header h3 { color: #38bdf8; font-size: 1.2rem; margin: 0; }
.close-modal { background: none; border: none; color: #94a3b8; font-size: 28px; cursor: pointer; line-height: 1; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; transition: all 0.2s; }
.close-modal:hover { background: rgba(148,163,184,0.1); color: white; }
.confirm-modal { z-index: 3000; }
.confirm-content { background: #131625; border-radius: 24px; padding: 24px; width: 280px; text-align: center; border: 1px solid #3b82f6; }
.confirm-buttons { display: flex; gap: 12px; margin-top: 20px; }
.confirm-buttons button { flex: 1; padding: 10px; border-radius: 30px; border: none; font-weight: bold; cursor: pointer; }
.confirm-yes { background: #ef4444; color: white; }
.confirm-no  { background: #334155; color: white; }

/* Timeframe */
.timeframe-buttons { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.timeframe-btn { background: #1e293b; border: 1px solid #334155; padding: 6px 14px; border-radius: 20px; color: #94a3b8; cursor: pointer; font-size: 0.8rem; transition: all 0.2s ease; }
.timeframe-btn:hover { background: #334155; color: white; }
.timeframe-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; box-shadow: 0 2px 4px rgba(59,130,246,0.3); }

/* Chart */
.chart-wrapper { position: relative; width: 100%; height: 350px; background: #0a0f1e; border-radius: 12px; overflow: hidden; }
.chart-wrapper canvas { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; cursor: crosshair; }
.chart-x-labels { position: relative; width: 100%; height: 36px; margin-top: 2px; overflow: visible; }
.chart-x-labels .x-label { position: absolute; transform: translateX(-50%); color: #94a3b8; font-size: 10px; white-space: nowrap; top: 4px; }
.chart-click-info { background: rgba(19,22,37,0.95); border: 1px solid #3b82f6; border-radius: 12px; padding: 10px 16px; font-size: 0.85rem; color: #e2e8f0; margin-top: 12px; text-align: center; backdrop-filter: blur(8px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); display: none; }
.chart-click-info.visible { display: block; animation: fadeInUp 0.3s ease; }
.chart-click-info strong { color: #38bdf8; }
.chart-loading, .chart-error { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; background: rgba(10,15,30,0.95); border-radius: 12px; z-index: 10; font-size: 0.9rem; }
.chart-loading { color: #38bdf8; }
.chart-error { color: #ef4444; }
.chart-error small { color: #64748b; margin-top: 8px; font-size: 0.75rem; }

/* ---------- Pair Combo ---------- */
.pair-combo { position: relative; }
.pair-selected {
    display: flex; align-items: center; justify-content: space-between;
    background: #1e293b; border: 1px solid #334155; border-radius: 14px;
    padding: 12px 16px; cursor: pointer;
    font-size: 1rem; font-weight: 700; color: #e2e8f0;
    transition: border-color 0.15s; user-select: none;
}
.pair-selected:hover { border-color: #3b82f6; }
.pair-chevron { color: #64748b; font-size: 0.7rem; margin-left: 8px; }
.pair-dropdown {
    display: none; position: absolute;
    top: calc(100% + 6px); left: 0; right: 0;
    background: #131625; border: 1px solid #3b82f6; border-radius: 16px;
    z-index: 700; box-shadow: 0 16px 40px rgba(0,0,0,0.65); overflow: hidden;
}
.pair-dropdown.open { display: block; }
.pair-search-wrap { padding: 10px 12px; border-bottom: 1px solid #1e293b; }
.pair-search-wrap input { width: 100%; background: #0a0f1e; border: 1px solid #334155; border-radius: 10px; padding: 9px 12px; color: #e2e8f0; font-size: 0.9rem; margin: 0; box-sizing: border-box; }
.pair-search-wrap input:focus { border-color: #3b82f6; outline: none; }
.pair-list { max-height: 230px; overflow-y: auto; }
.pair-opt { display: flex; align-items: center; gap: 10px; padding: 11px 16px; cursor: pointer; border-bottom: 1px solid #1a2035; transition: background 0.1s; }
.pair-opt:last-child { border-bottom: none; }
.pair-opt:hover      { background: #1e293b; }
.pair-opt-active     { background: #1e2d45; }
.pair-opt-active .pair-opt-sym { color: #3b82f6; }
.pair-opt-sym  { font-weight: 700; color: #e2e8f0; font-size: 0.88rem; flex: 1; }
.pair-graph-btn { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 2px 4px; opacity: 0.5; transition: opacity 0.15s; line-height: 1; }
.pair-graph-btn:hover { opacity: 1; }
.pair-opt-name { color: #64748b; font-size: 0.76rem; }
mark.pair-highlight { background: rgba(59,130,246,0.3); color: #93c5fd; border-radius: 3px; padding: 0 2px; font-weight: 900; }
.pair-no-result { padding: 14px 16px; color: #64748b; font-size: 0.85rem; text-align: center; }

/* ---------- Notifications ---------- */
.notification { position: fixed; bottom: 80px; left: 16px; right: 16px; background: #1e293b; border-left: 4px solid #3b82f6; padding: 12px 16px; border-radius: 12px; z-index: 1100; animation: fadeInUp 0.3s ease; font-size: 0.9rem; }
.notification.error   { border-left-color: #ef4444; background: #2a1e1e; }
.notification.success { border-left-color: #10b981; background: #0f2a1e; }
.notification-toast { position: fixed; bottom: 80px; left: 16px; right: 16px; background: #1e293b; border-left: 4px solid #3b82f6; padding: 12px 16px; border-radius: 12px; z-index: 2000; animation: slideUp 0.3s ease; }

/* ---------- Order Validation ---------- */
.order-validation-box { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 0.8rem; display: flex; flex-direction: column; gap: 4px; }
.val-has-error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); }
.val-has-warn  { background: rgba(16,185,129,0.05); border: 1px solid rgba(16,185,129,0.15); }
.val-error { color: #ef4444; }
.val-warn  { color: #64748b; }

/* ---------- Login Page ---------- */
body.login-page { display: flex; justify-content: center; align-items: center; padding: 20px; }
.login-card { background: #131625; border-radius: 32px; padding: 32px 24px; width: 90%; max-width: 400px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.login-card h1 { font-size: 1.8rem; margin-bottom: 24px; text-align: center; color: #3b82f6; }
.step { display: none; }
.step.active { display: block; }
.pin-inputs { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.pin-input { width: 50px; height: 60px; text-align: center; font-size: 1.8rem; background: #0f1222; border: 1px solid #2a2e45; border-radius: 12px; color: #fff; margin-bottom: 0; }
.pin-input:focus { border-color: #3b82f6; outline: none; }
.login-btn { width: 100%; padding: 14px; background: #3b82f6; border: none; border-radius: 40px; font-weight: bold; font-size: 1rem; margin-top: 16px; cursor: pointer; color: white; }
.login-btn:hover { opacity: 0.9; }
.link { text-align: center; margin-top: 16px; color: #3b82f6; cursor: pointer; font-size: 0.9rem; }
.link:hover { color: #cbd5e1; }
.error { color: #ef4444; font-size: 0.85rem; margin-top: 8px; text-align: center; min-height: 20px; }

/* ---------- Settings ---------- */
.info-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #2a2e45; }
.info-row:last-child { border-bottom: none; }
.info-label { color: #64748b; }
.info-value { color: #e2e8f0; font-weight: 500; text-align: right; word-break: break-all; }
.api-key-item { background: #0a0f1e; border-radius: 16px; padding: 12px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; border: 1px solid #2a2e45; }
.api-key-info { flex: 2; min-width: 150px; }
.api-key-info strong { color: #38bdf8; }
.api-key-actions { display: flex; gap: 8px; }
.api-key-actions button { padding: 6px 12px; font-size: 0.8rem; border-radius: 20px; border: none; font-weight: 600; cursor: pointer; }
.toggle-key-btn { background: #3b82f6; color: white; }
.delete-key-btn { background: #ef4444; color: white; }
.badge { display: inline-block; padding: 2px 8px; background: #334155; border-radius: 20px; font-size: 0.7rem; margin-top: 4px; }
.flex-buttons { display: flex; gap: 12px; margin-top: 16px; }
.flex-buttons button { flex: 1; margin-top: 0; }

/* Settings cards */
.settings-card { padding: 18px 16px; }
.settings-info-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid #1e293b; gap: 12px; }
.settings-info-row.no-border { border-bottom: none; }
.settings-info-label { font-size: 0.82rem; color: #64748b; flex-shrink: 0; }
.settings-info-value { font-size: 0.88rem; font-weight: 500; color: #e2e8f0; text-align: right; word-break: break-all; }
.settings-info-value.highlight { color: #38bdf8; font-weight: 700; }
.settings-btn { width: 100%; padding: 13px; background: linear-gradient(135deg, #2563eb, #3b82f6); border: none; border-radius: 40px; color: white; font-weight: 700; font-size: 0.92rem; cursor: pointer; transition: opacity 0.15s; margin-top: 4px; }
.settings-btn:hover { opacity: 0.9; }
.settings-btn-secondary { background: #1e293b; border: 1px solid #334155; color: #94a3b8; }
.settings-btn-secondary:hover { background: #263448; opacity: 1; }
.settings-btn-danger { background: linear-gradient(135deg, #dc2626, #ef4444); }
.settings-btn-row { display: flex; gap: 10px; margin-top: 4px; }
.settings-btn-row .settings-btn { margin-top: 0; }
.settings-error { color: #ef4444; font-size: 0.78rem; margin: 6px 0 4px; text-align: center; min-height: 18px; }

/* ---------- Position card extras ---------- */
.pos-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.pos-card-footer { display: flex; justify-content: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid #1e293b; }
.pos-close-btn { background: linear-gradient(135deg, #dc2626, #ef4444); border: none; color: #fff; font-size: 0.82rem; font-weight: 700; padding: 9px 32px; border-radius: 30px; cursor: pointer; transition: opacity 0.15s; }
.pos-close-btn:hover { opacity: 0.85; }
.pos-info-row { display: flex; justify-content: space-between; font-size: 0.82rem; color: #94a3b8; margin-bottom: 4px; }
.pos-pnl-row { font-size: 0.88rem; color: #94a3b8; margin-bottom: 4px; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title-row .card-title { margin-bottom: 0; }
.pos-tab-bar { display:flex; align-items:center; gap:4px; margin-bottom:12px; border-bottom:1px solid #1e293b; padding-bottom:8px; flex-wrap:wrap; }
.pos-tab { background:none; border:none; color:#64748b; font-size:0.85rem; font-weight:600; padding:6px 12px; border-radius:8px; cursor:pointer; transition:all 0.15s; }
.pos-tab:hover { color:#e2e8f0; background:#1e293b; }
.pos-tab-active { color:#3b82f6; background:#1e3a5f; }
.close-all-btn { background: linear-gradient(135deg, #dc2626, #ef4444); border: none; color: #fff; font-size: 0.75rem; font-weight: 700; padding: 5px 12px; border-radius: 20px; cursor: pointer; transition: opacity 0.15s; white-space: nowrap; flex-shrink: 0; }
.close-all-btn:hover { opacity: 0.85; }
.close-all-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Liquidation badges */
.liq-badge { font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; flex-shrink: 0; white-space: nowrap; }
.liq-warn   { background: rgba(234,179,8,0.15); color: #eab308; border: 1px solid rgba(234,179,8,0.3); }
.liq-danger { background: rgba(239,68,68,0.18); color: #ef4444; border: 1px solid rgba(239,68,68,0.4); animation: liq-pulse 1.2s ease-in-out infinite; }
@keyframes liq-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pos-card-danger { border-color: rgba(239,68,68,0.5) !important; box-shadow: 0 0 0 1px rgba(239,68,68,0.25); }

/* Reuse button */
.reuse-btn { background: transparent; border: 1px solid var(--accent); color: var(--accent); font-size: 0.72rem; font-weight: 600; padding: 4px 10px; border-radius: 20px; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: background 0.15s; }
.reuse-btn:hover { background: #1e4a8f; }

/* ---------- Top bar right ---------- */
.top-bar-right { display: flex; align-items: center; gap: 8px; }
.mode-pill { display: flex; align-items: center; gap: 6px; background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.35); border-radius: 30px; padding: 5px 12px; font-size: 0.72rem; font-weight: 800; color: #10b981; letter-spacing: 0.06em; white-space: nowrap; text-decoration: none; cursor: pointer; transition: background 0.2s; }
.mode-pill:hover { background: rgba(16,185,129,0.25); }
.mode-pill-dot { width: 7px; height: 7px; border-radius: 50%; }
.mode-pill-dot.demo { background: #10b981; animation: pulseDot 2s infinite; }
.mode-pill-dot.live { background: #ef4444; animation: pulseLive 1s infinite; }
@keyframes pulseDot  { 0%,100%{opacity:1} 50%{opacity:0.35} }
@keyframes pulseLive { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.5;transform:scale(1.4)} }

/* ---------- Notification bell ---------- */
.notif-bell { position: relative; background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 4px; line-height: 1; display: flex; align-items: center; }
.notif-badge { position: absolute; top: -4px; right: -6px; background: #ef4444; color: #fff; font-size: 0.6rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; pointer-events: none; }
.notif-panel { position: fixed; top: 56px; right: 8px; width: calc(100vw - 16px); max-width: 380px; background: #131625; border: 1px solid #2a2e45; border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); z-index: 1200; overflow: hidden; }
.notif-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid #2a2e45; }
.notif-panel-title { font-weight: 700; font-size: 0.95rem; color: #e2e8f0; }
.notif-panel-actions { display: flex; gap: 8px; align-items: center; }
.notif-read-all-btn, .notif-see-all-btn { font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 20px; cursor: pointer; text-decoration: none; }
.notif-read-all-btn { background: #1e293b; border: 1px solid #3b82f6; color: #38bdf8; }
.notif-see-all-btn  { background: #2563eb; border: none; color: #fff; }
.notif-panel-list { max-height: 320px; overflow-y: auto; padding: 8px 0; }
.notif-overlay { position: fixed; inset: 0; z-index: 1100; background: transparent; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; align-items: flex-start; cursor: pointer; transition: background 0.1s; }
.notif-item:hover  { background: rgba(255,255,255,0.04); }
.notif-item.unread { background: rgba(59,130,246,0.07); }
.notif-icon  { font-size: 1.2rem; flex-shrink: 0; line-height: 1; margin-top: 1px; }
.notif-body  { flex: 1; min-width: 0; }
.notif-title { font-weight: 700; font-size: 0.82rem; color: #e2e8f0; margin-bottom: 2px; }
.notif-msg   { font-size: 0.78rem; color: #94a3b8; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time  { font-size: 0.7rem; color: #475569; }
.notif-empty, .notif-loading { text-align: center; padding: 24px; color: #475569; font-size: 0.85rem; }

/* Alarm modal */
.alarm-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1300; }
.alarm-modal { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; background: #131625; border-radius: 24px 24px 0 0; border: 1px solid #2a2e45; border-bottom: none; padding: 20px 20px 32px; z-index: 1400; box-shadow: 0 -8px 32px rgba(0,0,0,0.5); }
.alarm-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.alarm-modal-title { font-weight: 700; font-size: 1rem; color: #e2e8f0; }
.alarm-modal-close { background: none; border: none; color: #94a3b8; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.alarm-pair-label    { font-size: 1.1rem; font-weight: 800; color: #38bdf8; margin-bottom: 2px; }
.alarm-current-price { font-size: 0.82rem; color: #64748b; margin-bottom: 14px; }
.alarm-field { margin-bottom: 14px; }
.alarm-field label { display: block; font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.alarm-condition-row { display: flex; gap: 8px; }
.alarm-cond-btn, .alarm-unit-btn { flex: 1; background: #1e293b; border: 1px solid #2a2e45; color: #94a3b8; font-size: 0.8rem; font-weight: 600; padding: 8px; border-radius: 12px; cursor: pointer; transition: all 0.15s; text-align: center; }
.alarm-cond-btn.active, .alarm-unit-btn.active { background: #2563eb; border-color: #3b82f6; color: #fff; }
.alarm-save-btn { width: 100%; background: linear-gradient(135deg, #2563eb, #3b82f6); border: none; color: #fff; font-size: 0.95rem; font-weight: 700; padding: 14px; border-radius: 14px; cursor: pointer; margin-top: 4px; }
.alarm-save-btn:hover { opacity: 0.9; }
.alarm-existing-list { margin-bottom: 12px; }
.alarm-existing-title { font-size: 0.75rem; color: #64748b; margin-bottom: 6px; }
.alarm-existing-item { display: flex; justify-content: space-between; align-items: center; background: #1e293b; border-radius: 10px; padding: 7px 10px; margin-bottom: 5px; font-size: 0.82rem; color: #e2e8f0; }
.alarm-del-btn { background: none; border: none; color: #ef4444; cursor: pointer; font-size: 0.9rem; padding: 0 4px; }
.alarm-btn { background: none; border: none; font-size: 1rem; cursor: pointer; padding: 2px 4px; flex-shrink: 0; opacity: 0.7; transition: opacity 0.15s; }
.alarm-btn:hover { opacity: 1; }

/* ---------- Notification Page ---------- */
.notif-page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.notif-read-all-page-btn { background: #1e293b; border: 1px solid #3b82f6; color: #38bdf8; font-size: 0.78rem; font-weight: 600; padding: 6px 14px; border-radius: 20px; cursor: pointer; }
.notif-read-all-page-btn:hover { background: #263448; }
.notif-page-list { display: flex; flex-direction: column; gap: 10px; }
.notif-page-item { background: #1a2235; border-radius: 14px; padding: 14px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid #2a2e45; cursor: pointer; transition: border-color 0.15s; }
.notif-page-item.unread { border-color: #3b82f6; background: #162033; }
.notif-page-item:hover { border-color: #38bdf8; }
.notif-page-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.notif-page-body { flex: 1; min-width: 0; }
.notif-page-item-title { font-weight: 700; font-size: 0.92rem; color: #e2e8f0; margin-bottom: 3px; }
.notif-page-msg  { font-size: 0.83rem; color: #94a3b8; margin-bottom: 5px; word-break: break-word; }
.notif-page-time { font-size: 0.72rem; color: #475569; }
.notif-page-unread-dot { width: 8px; height: 8px; background: #3b82f6; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.notif-empty-state { text-align: center; color: #475569; padding: 40px 20px; font-size: 0.95rem; }
.notif-empty-state .notif-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.notif-load-more { width: 100%; background: #1e293b; border: 1px solid #2a2e45; color: #38bdf8; padding: 12px; border-radius: 14px; font-size: 0.85rem; cursor: pointer; margin-top: 4px; }
.notif-type-alarm       { color: #f59e0b; }
.notif-type-liquidation { color: #ef4444; }
.notif-type-profit      { color: #10b981; }
.notif-type-loss        { color: #ef4444; }
.notif-type-info        { color: #38bdf8; }
.notif-read-all-footer-btn { background: #1e293b; border: 1px solid #3b82f6; color: #38bdf8; }
.notif-read-all-footer-btn:hover { background: #263448; }

/* ---------- Wallet ---------- */
.wallet-closed-card { border-left: 3px solid #334155; }
.wallet-badge { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; flex-shrink: 0; }
.wallet-badge.long  { background: rgba(16,185,129,0.18); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.wallet-badge.short { background: rgba(239,68,68,0.18); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.wallet-badge.liq   { background: rgba(239,68,68,0.18); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.wallet-pnl-row     { font-size: 0.88rem; color: #94a3b8; margin: 4px 0; }
.wallet-closed-time { font-size: 0.73rem; color: #475569; margin-top: 6px; }
.wallet-empty       { text-align: center; color: #475569; padding: 28px 16px; font-size: 0.88rem; }

/* ---------- Transactions ---------- */
.tx-item { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border-radius: 14px; background: #131b2e; margin-bottom: 8px; border: 1px solid #1e293b; gap: 10px; }
.tx-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tx-icon { font-size: 1.2rem; flex-shrink: 0; line-height: 1; }
.tx-details { min-width: 0; }
.tx-type { font-size: 0.83rem; font-weight: 600; color: #e2e8f0; text-transform: capitalize; }
.tx-time { font-size: 0.7rem; color: #475569; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-right { text-align: right; flex-shrink: 0; }
.tx-amount { font-size: 0.85rem; font-weight: 700; }
.tx-balance { font-size: 0.7rem; color: #475569; margin-top: 2px; }

/* ---------- Mini Chart ---------- */
.mini-chart-container { background: #0a0f1e; border-radius: 16px; padding: 12px; margin-bottom: 16px; border: 1px solid #2a2e45; }
.mini-chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #2a2e45; }
.mini-chart-symbol { font-weight: 700; font-size: 0.9rem; color: #38bdf8; }
.mini-chart-price  { font-weight: 700; font-size: 1rem; color: #e2e8f0; }
.mini-chart-change { font-size: 0.8rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.mini-chart-change.positive { color: #10b981; background: rgba(16,185,129,0.1); }
.mini-chart-change.negative { color: #ef4444; background: rgba(239,68,68,0.1); }
.mini-chart-wrapper { width: 100%; height: 60px; position: relative; }
.mini-chart-wrapper canvas { width: 100% !important; height: 60px !important; }
.mini-chart-tf-row { display: flex; gap: 6px; margin-bottom: 8px; }
.mini-tf-btn { background: #1e293b; border: 1px solid #2a2e45; color: #94a3b8; font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.mini-tf-btn:hover  { background: #263448; color: #e2e8f0; }
.mini-tf-btn.active { background: #38bdf8; border-color: #38bdf8; color: #0a0f1e; }

/* ---------- Debug ---------- */
.debug-btn   { position: fixed; bottom: 20px; right: 20px; background: #334155; border-radius: 30px; padding: 8px 16px; font-size: 12px; cursor: pointer; z-index: 1000; border: none; color: white; }
.debug-panel { position: fixed; bottom: 80px; right: 20px; left: 20px; max-height: 300px; background: #0f1222; border: 1px solid #3b82f6; border-radius: 16px; overflow-y: auto; z-index: 999; display: none; padding: 12px; font-family: monospace; font-size: 11px; color: #cbd5e1; }
.debug-panel.show { display: block; }
.log-entry   { border-bottom: 1px solid #334155; padding: 6px; font-size: 11px; }
.log-error   { color: #f87171; }
.log-success { color: #4ade80; }

/* ---------- Utilities ---------- */
.hidden      { display: none !important; }
.text-green  { color: #10b981; }
.text-red    { color: #ef4444; }

/* ---------- Pin Pad ---------- */
.pin-display-row { display: flex; flex-direction: column; align-items: center; margin: 18px 0 10px; }
.pin-dots { display: flex; gap: 16px; justify-content: center; }
.pin-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #3b82f6; background: transparent; transition: background 0.15s, transform 0.1s; display: inline-block; }
.pin-dot.filled { background: #3b82f6; transform: scale(1.15); }
.pin-label { margin: 10px 0 0; font-size: 0.82rem; color: #94a3b8; letter-spacing: 0.03em; }
@keyframes shake { 0%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} 100%{transform:translateX(0)} }
.shake { animation: shake 0.38s ease; }
.pin-pad { margin: 6px 0 4px; }
.pin-pad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.pin-key { position: relative; height: 64px; border-radius: 50%; border: 1.5px solid #2a2e45; background: #161829; color: #e2e8f0; font-size: 1.5rem; font-weight: 500; cursor: pointer; transition: background 0.13s, border-color 0.13s, transform 0.1s; display: flex; align-items: center; justify-content: center; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.pin-key:active, .pin-key.pressed { background: #1e2d4a; border-color: #3b82f6; transform: scale(0.92); }
.pin-key:disabled, .pin-key-empty { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }
.pin-key-del { font-size: 1.3rem; color: #94a3b8; }
.pin-key-del:active, .pin-key-del.pressed { color: #e2e8f0; background: #1e2d4a; border-color: #3b82f6; }

/* ---------- Animations ---------- */
@keyframes fadeInUp  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .modal, .modal.open { padding: 0 !important; align-items: flex-end !important; }
    .modal-content { width: 98% !important; max-width: 98% !important; padding: 12px 4px 20px !important; border-radius: 16px 16px 0 0 !important; max-height: 92vh !important; margin: 0 auto !important; }
    .chart-wrapper { height: 300px; }
    .timeframe-btn { padding: 4px 10px; font-size: 0.7rem; }
    /* Graph modal specific: remove any extra padding */
    #graphModal .modal-content {
        padding: 8px 2px 16px !important;
    }
    #graphModal .chart-wrapper {
        height: 280px;
    }
    #graphModal .timeframe-buttons {
        gap: 4px;
        justify-content: center;
    }
    #graphModal .timeframe-btn {
        padding: 4px 8px;
        font-size: 0.68rem;
    }
    #graphModal .modal-header {
        padding: 0 4px 8px 8px;
    }
}

/* ============================================================
   BOT TRADING PAGE (bot.html)
   ============================================================ */

.bot-page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.bot-page-title  { font-size: 1.4rem; font-weight: 800; color: #f59e0b; display: flex; align-items: center; gap: 8px; }
.new-bot-btn { background: var(--accent); border: none; padding: 10px 20px; border-radius: 30px; color: var(--accent-text); font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.net-pnl-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid #1e293b; margin-top: 8px; }
.net-pnl-label { font-size: 0.72rem; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.net-pnl-val { font-size: 1.1rem; font-weight: 700; }
.stop-all-btn { background: var(--accent); border: none; padding: 8px 16px; border-radius: 30px; color: var(--accent-text); font-weight: 700; font-size: 0.82rem; cursor: pointer; transition: opacity 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.stop-all-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.bot-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid #2a2e45; padding-bottom: 4px; }
.bot-tab { padding: 10px 20px; background: transparent; border: none; color: #64748b; font-weight: 700; font-size: 0.9rem; cursor: pointer; border-radius: 30px; }
.bot-tab.active { background: var(--accent); color: var(--accent-text); }
.bot-tab:not(.active):hover { color: #e2e8f0; background: #1e293b; }

.setup-card  { background: #131625; border: 1px solid #2a2e45; border-radius: 20px; padding: 20px; margin-bottom: 20px; }
.setup-title { font-size: 0.85rem; font-weight: 700; color: #38bdf8; margin-bottom: 16px; text-transform: uppercase; }
.form-group  { margin-bottom: 16px; }
.form-label  { font-size: 0.72rem; color: #64748b; margin-bottom: 6px; display: block; text-transform: uppercase; }

/* Bot card */
.bot-card        { background: #131625; border: 1px solid #2a2e45; border-radius: 20px; padding: 18px; margin-bottom: 16px; }
.bot-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.bot-name        { font-weight: 700; font-size: 1rem; color: #e2e8f0; }
.bot-pair        { font-size: 0.8rem; color: #38bdf8; font-weight: 700; }

.status-badge            { padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.status-running          { background: #10b981; color: white; }
.status-completed        { background: #6366f1; color: white; }
.status-stopped          { background: #ef4444; color: white; }
.status-loss_limit_hit   { background: #f59e0b; color: #000; }
.status-profit_limit_hit { background: #34d399; color: #000; }

.leverage-badge { background: #1e3a5f; color: #38bdf8; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 12px; margin-left: 8px; }

.bot-price-row { display: flex; justify-content: space-between; background: #0a0f1e; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.price-label   { font-size: 0.7rem; color: #64748b; text-transform: uppercase; }
.price-val     { font-size: 1rem; font-weight: 700; color: #38bdf8; }

.bot-entry-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.entry-box     { background: #0a0f1e; border-radius: 12px; padding: 8px 12px; text-align: center; }
.entry-label   { font-size: 0.6rem; color: #64748b; text-transform: uppercase; }
.entry-val     { font-size: 0.85rem; font-weight: 700; color: #e2e8f0; }

.pnl-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pnl-box  { background: #0a0f1e; border-radius: 12px; padding: 10px; text-align: center; }
.pnl-label { font-size: 0.65rem; color: #64748b; text-transform: uppercase; }
.pnl-pct   { font-size: 1.1rem; font-weight: 800; }
.pnl-usdt  { font-size: 0.7rem; margin-top: 2px; }
.pnl-positive { color: #10b981; }
.pnl-negative { color: #ef4444; }

.steps-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.steps-box  { background: #0a0f1e; border-radius: 12px; padding: 10px; }
.steps-label { font-size: 0.65rem; color: #64748b; text-transform: uppercase; margin-bottom: 6px; }
.steps-bar-track { background: #1e293b; border-radius: 20px; height: 6px; overflow: hidden; }
.steps-bar-fill  { height: 6px; border-radius: 20px; transition: width 0.3s; }
.steps-bar-loss  { background: #ef4444; }
.steps-bar-gain  { background: #10b981; }
.steps-count     { font-size: 0.75rem; font-weight: 700; color: #e2e8f0; margin-top: 5px; text-align: center; }

.margin-info { font-size: 0.72rem; color: #f59e0b; margin-bottom: 4px; text-align: center; }
.effective-margin-info { font-size: 0.72rem; margin-bottom: 10px; text-align: center; font-weight: 600; }
.effective-margin-info .em-label { color: #94a3b8; }
.effective-positive { color: #10b981; }
.effective-negative { color: #ef4444; }
.effective-neutral  { color: #f59e0b; }

.bot-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stop-btn    { background: #ef4444; border: none; padding: 10px; border-radius: 30px; color: white; font-weight: 700; cursor: pointer; }

.empty-state { text-align: center; padding: 40px 20px; color: #4b5563; }
.empty-icon  { font-size: 3rem; margin-bottom: 10px; }

.split-toggle { display: flex; gap: 0; border-radius: 12px; overflow: hidden; border: 1px solid #2a2e45; }
.split-opt { flex: 1; padding: 10px 6px; background: #0a0f1e; color: #64748b; font-size: 0.75rem; font-weight: 700; cursor: pointer; border: none; text-align: center; }
.split-opt.active { background: var(--accent); color: var(--accent-text); }
.split-field         { display: none; }
.split-field.visible { display: block; }

.bot-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.bot-pv-item  { background: #0a0f1e; border-radius: 10px; padding: 8px; text-align: center; }
.bot-pv-label { font-size: 0.6rem; color: #64748b; text-transform: uppercase; }
.bot-pv-val   { font-size: 0.8rem; font-weight: 700; color: #e2e8f0; }

.start-btn { width: 100%; padding: 14px; background: var(--accent); border: none; border-radius: 40px; color: var(--accent-text); font-weight: 800; font-size: 1rem; cursor: pointer; }

.bot-type-badge              { display: inline-block; font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }
.bot-type-standard           { background: #1e3a5f; color: #38bdf8; }
.bot-type-threshold_entry    { background: #1a2e1a; color: #4ade80; }
.bot-type-smart_hold         { background: #2a1e3a; color: #c084fc; }

.template-info           { background: #0a0f1e; border-radius: 12px; padding: 12px; margin-bottom: 16px; display: none; }
.template-info.visible   { display: block; }
.template-params         { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.template-params-sh      { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.template-param          { text-align: center; }
.template-param-label    { font-size: 0.6rem; color: #64748b; }
.template-param-val      { font-size: 0.8rem; font-weight: 700; color: #e2e8f0; }
.template-desc           { font-size: 0.75rem; color: #94a3b8; margin-bottom: 8px; font-style: italic; }

.sh-template-info         { display: none; background: #0d0820; border: 1px solid #3b0764; border-radius: 10px; padding: 10px; margin-top: 8px; }
.sh-template-info.visible { display: block; }

.size-pct-btn { flex: 1; padding: 6px; background: #1e293b; border: none; border-radius: 8px; color: #94a3b8; font-size: 0.7rem; cursor: pointer; transition: all 0.15s; }
.size-pct-btn:hover { background: var(--accent); color: var(--accent-text); }
.max-size-info  { font-size: 0.7rem; color: #64748b; margin-top: 4px; text-align: right; }
.balance-warning { color: #ef4444; font-size: 0.75rem; margin-top: 4px; }

/* ============================================================
   BOT ADMIN PAGE (admin_bot.html)
   ============================================================ */

.ab-header { font-size: 1.4rem; font-weight: 800; color: #f59e0b; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ab-header button { font-size: 0.85rem; padding: 9px 18px; border-radius: 30px; border: none; background: #3b82f6; color: #fff; font-weight: 700; cursor: pointer; }

.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-box  { background: #0a0f1e; border-radius: 14px; padding: 12px; text-align: center; }
.stat-label { font-size: 0.7rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-val   { font-size: 1.4rem; font-weight: 800; color: #38bdf8; }

/* Admin bot card (overrides base .bot-card for admin context) */
.bot-card .bot-desc    { font-size: 0.8rem; color: #64748b; margin-bottom: 10px; }
.bot-card .bot-params  { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: 10px; }
.bot-param             { background: #0a0f1e; border-radius: 10px; padding: 8px 10px; }
.bot-param-label       { font-size: 0.65rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.bot-param-val         { font-size: 0.95rem; font-weight: 700; color: #e2e8f0; }
.running-badge         { background: #f59e0b; color: #000; padding: 2px 8px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; margin-left: 6px; }
.bot-actions           { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.bot-actions button    { padding: 7px 14px; border-radius: 30px; border: none; font-weight: 700; font-size: 0.78rem; cursor: pointer; transition: opacity .15s; }
.btn-edit   { background: #6366f1; color: #fff; }
.btn-toggle { background: #f59e0b; color: #000; }
.btn-delete { background: #ef4444; color: #fff; }

.status-active   { background: #10b981; color: #fff; }
.status-inactive { background: #334155; color: #94a3b8; }

.bot-type-pill              { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 10px; margin-left: 6px; }
.bot-type-pill.standard     { background: #1e3a5f; color: #38bdf8; }
.bot-type-pill.threshold_entry { background: #1a2e1a; color: #4ade80; }
.bot-type-pill.smart_hold   { background: #2a1e3a; color: #c084fc; }

/* Smart Hold Section */
.smart-hold-section  { border: 1px solid #3b0764; background: linear-gradient(135deg, #1a0a2e 0%, #0f0a1e 100%); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.sh-section-title    { font-size: 0.72rem; font-weight: 800; color: #c084fc; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.sh-state-row        { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sh-state-pill       { padding: 4px 10px; border-radius: 20px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; border: 1px solid transparent; }
.sh-state-pill.running   { background: #0d2e1a; border-color: #10b981; color: #10b981; }
.sh-state-pill.completed { background: #1e1b4b; border-color: #6366f1; color: #a5b4fc; }
.sh-state-pill.stopped   { background: #2a1515; border-color: #ef4444; color: #fca5a5; }
.sh-state-pill.loss_hit  { background: #2a1a08; border-color: #f59e0b; color: #fcd34d; }
.sh-state-pill.profit_hit { background: #0a2218; border-color: #34d399; color: #6ee7b7; }

/* State Machine Diagram */
.sm-diagram       { background: #0a0f1e; border: 1px solid #2a2e45; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.sm-diagram-title { font-size: 0.65rem; color: #c084fc; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.sm-states        { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sm-state         { padding: 3px 9px; border-radius: 10px; font-size: 0.62rem; font-weight: 700; }
.sm-state.run  { background: #0d2e1a; color: #10b981; border: 1px solid #10b981; }
.sm-state.comp { background: #1e1b4b; color: #a5b4fc; border: 1px solid #6366f1; }
.sm-state.stop { background: #2a1515; color: #fca5a5; border: 1px solid #ef4444; }
.sm-state.loss { background: #2a1a08; color: #fcd34d; border: 1px solid #f59e0b; }
.sm-state.prof { background: #0a2218; color: #6ee7b7; border: 1px solid #34d399; }
.sm-rules       { font-size: 0.62rem; color: #64748b; line-height: 1.6; }
.sm-rules span  { color: #94a3b8; }

.step-logic-box   { background: #0a0f1e; border: 1px solid #2a2e45; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.step-logic-title { font-size: 0.65rem; color: #38bdf8; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.step-logic-item  { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 5px; }
.step-logic-dot   { width: 7px; height: 7px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }
.step-logic-dot.loss { background: #ef4444; }
.step-logic-dot.gain { background: #10b981; }
.step-logic-text  { font-size: 0.62rem; color: #94a3b8; line-height: 1.5; }

/* Admin Modal */
.ab-modal         { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.88); z-index: 3000; justify-content: center; align-items: flex-start; padding: 16px; box-sizing: border-box; overflow-y: auto; }
.ab-modal.open    { display: flex; }
.ab-modal-content { background: #131625; border-radius: 24px; width: 100%; max-width: 460px; padding: 24px; border: 1px solid #3b82f6; margin: auto; }
.ab-modal-content.smart-hold-modal { border-color: #7c3aed; }
.ab-modal-title   { font-size: 1.15rem; font-weight: 800; color: #38bdf8; margin-bottom: 18px; }
.ab-modal label   { display: block; font-size: 0.73rem; color: #64748b; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.ab-modal input, .ab-modal select, .ab-modal textarea { width: 100%; margin-bottom: 14px; box-sizing: border-box; }
.ab-modal textarea { min-height: 70px; resize: vertical; }
.form-row-2       { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-2 > div { display: flex; flex-direction: column; }
.ab-modal-btns    { display: flex; gap: 10px; margin-top: 8px; }
.ab-modal-btns button { flex: 1; padding: 12px; border-radius: 40px; border: none; font-weight: 700; cursor: pointer; font-size: 0.95rem; }
.modal-save   { background: #3b82f6; color: #fff; }
.modal-cancel { background: #334155; color: #fff; }

.cron-box       { background: #0a0f1e; border: 1px solid #2a2e45; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; }
.cron-box-title { font-size: 0.75rem; color: #f59e0b; font-weight: 700; margin-bottom: 6px; text-transform: uppercase; }
.cron-code      { font-family: monospace; font-size: 0.8rem; color: #38bdf8; word-break: break-all; }

.split-note { font-size: 0.7rem; color: #64748b; margin-top: 3px; }

.sh-extra-fields         { display: none; }
.sh-extra-fields.visible { display: block; }
.sh-field-group          { background: #0a0f1e; border: 1px solid #2a2e45; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.sh-field-group-title    { font-size: 0.62rem; font-weight: 800; color: #c084fc; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px; }

.smart-hold-details { margin-top: 8px; border-top: 1px dashed #2a2e45; padding-top: 6px; font-size: 0.75rem; }
.smart-param        { display: inline-block; background: #1e293b; padding: 2px 8px; border-radius: 12px; margin-right: 6px; margin-top: 4px; font-size: 0.65rem; color: #c084fc; }

/* ============================================================
   DASHBOARD PAGE (dash.html)
   ============================================================ */

.dash-section-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 20px 0 10px;
}

.dash-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.dash-stat-card {
    background: #131625;
    border: 1px solid #2a2e45;
    border-radius: 16px;
    padding: 14px 12px;
    text-align: center;
}

.dash-stat-label {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.dash-stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #e2e8f0;
}

.dash-card {
    background: #131625;
    border: 1px solid #2a2e45;
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 20px;
}

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

.dash-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #38bdf8;
}

.dash-view-all {
    font-size: 0.78rem;
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
}
.dash-view-all:hover { color: #60a5fa; }

.dash-pos-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #1e293b;
}
.dash-pos-row:last-child { border-bottom: none; }

.dash-pos-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.dash-pos-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.dash-pos-pair {
    font-weight: 700;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.dash-bot-name {
    font-size: 0.72rem;
    color: #64748b;
}

.dash-pos-pnl {
    font-size: 0.85rem;
    font-weight: 700;
}

.dash-pos-price {
    font-size: 0.7rem;
    color: #64748b;
}

.dash-more {
    text-align: center;
    padding: 8px 0 2px;
    font-size: 0.78rem;
}
.dash-more a { color: #3b82f6; text-decoration: none; }
.dash-more a:hover { color: #60a5fa; }

.dash-empty {
    text-align: center;
    color: #475569;
    padding: 18px 10px;
    font-size: 0.85rem;
}
.dash-empty a { color: #3b82f6; text-decoration: none; }
/* ── Stopped bot card ────────────────────────────────────── */
.bot-card-stopped { opacity: 0.92; }
.stopped-summary  { text-align: center; padding: 14px 0 8px; }
.stopped-pnl      { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stopped-pnl-label{ font-size: 0.72rem; color: #64748b; margin-top: 2px; }
.stopped-details  { background: #0d0f1e; border-radius: 12px; padding: 10px 14px; margin: 8px 0 12px; }
.stopped-detail-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; border-bottom: 1px solid #1e2235; font-size: 0.78rem;
}
.stopped-detail-row:last-child { border-bottom: none; }
.stopped-detail-row span:first-child { color: #64748b; }
.stopped-detail-row span:last-child  { color: #e2e8f0; font-weight: 500; }
/* Ultra‑compact modals on mobile */
@media (max-width: 640px) {
    /* Graph modal */
    #graphModal.modal {
        padding: 0 !important;
        align-items: flex-end !important;
    }
    #graphModal .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 8px 4px 16px 4px !important;
        border-radius: 16px 16px 0 0 !important;
        background: #0a0f1e;
    }
    #graphModal .modal-header {
        padding: 0 6px 6px 6px !important;
    }
    #graphModal .timeframe-buttons {
        gap: 4px;
        padding: 0 4px;
        justify-content: center;
    }
    #graphModal .timeframe-btn {
        padding: 3px 8px;
        font-size: 0.65rem;
    }
    #graphModal .chart-wrapper {
        margin: 0;
        height: 260px;
    }
    #graphModal .chart-x-labels {
        margin: 0 2px;
    }

    /* Step log (journal) – targets the dynamically created modal */
    div[style*="position:fixed"][style*="background:rgba(0,0,0,0.85)"] > div:first-child {
        width: calc(100% - 8px) !important;
        margin: 0 4px !important;
        border-radius: 16px !important;
    }
    /* Adjust inner table for better fit */
    .step-log-modal table,
    div[style*="position:fixed"] table {
        font-size: 0.68rem !important;
    }
    .step-log-modal td,
    .step-log-modal th,
    div[style*="position:fixed"] td,
    div[style*="position:fixed"] th {
        padding: 4px 2px !important;
    }
}
.stop-bot-btn { background: var(--accent) !important; color: var(--accent-text) !important; border-color: var(--accent) !important; }