/* ==========================================================================
   SANDEEP CRYPTO MACHINE - ULTRA MODERN PRO TERMINAL STYLESHEET
   ========================================================================== */

:root {
    color-scheme: dark;
    --bg-main: #0b0e14;
    --bg-card: #121721;
    --bg-card-hover: #161c29;
    --bg-surface: #1a2233;
    --bg-input: #0a0d13;
    --border-subtle: #1e293b;
    --border-glow: rgba(245, 158, 11, 0.3);
    
    --accent-gold: #f59e0b;
    --accent-gold-glow: rgba(245, 158, 11, 0.15);
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.15);
    --accent-red: #f43f5e;
    --accent-red-glow: rgba(244, 63, 94, 0.15);
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --header-h: 60px;
    --dock-h: 46px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overscroll-behavior-y: contain; /* Prevents accidental pull-to-refresh on mobile */
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-ui);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    letter-spacing: -0.01em;
}

.mono {
    font-family: var(--font-mono);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #090c10;
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* ==========================================================================
   HEADER & TOP NAVIGATION
   ========================================================================== */
.pro-header {
    background: rgba(11, 14, 20, 0.98);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
    height: 60px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    font-family: var(--font-ui);
    font-weight: 900;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #ea580c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    white-space: nowrap;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.pill-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.mode-toggle {
    display: flex;
    background: #090c10;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 2px;
}

.mode-btn {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 800;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.mode-btn.active#mode-demo {
    background: #0284c7;
    color: #fff;
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
}

.mode-btn.active#mode-real {
    background: #10b981 !important;
    color: #042f2e !important;
    font-weight: 900 !important;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.6) !important;
}

.conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.conn-dot.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulseGlow 2s infinite;
}
.conn-dot.connecting {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}
.conn-dot.offline {
    background: #f43f5e;
    box-shadow: 0 0 8px #f43f5e;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

/* ==========================================================================
   TERMINAL PANE CARD
   ========================================================================== */
.pane-card {
    background: var(--bg-card);
    border: 1px solid #1e293b;
    border-radius: 14px;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Top Asset Ribbon */
.asset-ribbon {
    background: rgba(18, 23, 33, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.coin-select-styled {
    background: #0f172a;
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font-mono);
    cursor: pointer;
    outline: none;
    transition: 0.2s;
}
.coin-select-styled:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

/* Coin Switch Card Header & Action Pills (Matching Header Pill Aesthetics) */
.pair-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
    width: 100%;
    padding-left: 44px;  /* Symmetrical breathing room clear of left CONTROLS tab */
    padding-right: 44px; /* Symmetrical breathing room clear of right LOGS tab */
    box-sizing: border-box;
}

.pair-header-main {
    flex: 1 1 auto;
    min-width: 0;
}

.pair-price {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.coin-select-box {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #000000 !important;
    border: 1px solid #334155 !important;
    border-radius: 8px;
    padding: 2px 8px;
    height: 28px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.coin-select-box label {
    color: #94a3b8 !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
}

.coin-select-box select,
#symbol-selector {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    font-family: var(--font-mono) !important;
    border: none !important;
    outline: none !important;
    cursor: pointer !important;
    color-scheme: dark !important;
}

.coin-select-box select option,
#symbol-selector option {
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    padding: 8px 12px !important;
}

.coin-select-box select option:hover,
.coin-select-box select option:checked,
#symbol-selector option:checked {
    background: #1e293b !important;
    background-color: #1e293b !important;
    color: #38bdf8 !important;
}

.coin-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 28px;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.coin-action-btn.trades {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #c084fc;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.15);
}
.coin-action-btn.trades:hover, .coin-action-btn.trades:active {
    background: rgba(168, 85, 247, 0.25);
    border-color: #c084fc;
    color: #fff;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.35);
}

.coin-action-btn.chart {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.15);
}
.coin-action-btn.chart:hover, .coin-action-btn.chart:active {
    background: rgba(56, 189, 248, 0.25);
    border-color: #38bdf8;
    color: #fff;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}

.coin-action-btn.mtm {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fbbf24;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.15);
}
.coin-action-btn.mtm:hover, .coin-action-btn.mtm:active {
    background: rgba(245, 158, 11, 0.25);
    border-color: #fbbf24;
    color: #fff;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}

.coin-trading-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 2px 8px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.quick-action-btn {
    background: #1a2233;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: var(--font-mono);
}
.quick-action-btn:hover {
    border-color: #94a3b8;
    color: #fff;
    transform: translateY(-1px);
}

/* 2-Column Responsive Dashboard Layout */
.terminal-grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

@media (max-width: 1024px) {
    .terminal-grid-layout {
        grid-template-columns: 1fr;
    }
}

/* Strategy & Controls Hub */
.control-card {
    background: #0f141f;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-box-btn {
    background: #141b29;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}
.menu-box-btn:hover {
    background: #1a2233;
    border-color: #334155;
}

.clickable-label {
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Sleek Toggle Switches */
.tg-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    flex-shrink: 0;
}
.tg-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.tg-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155;
    transition: .3s;
    border-radius: 22px;
}
.tg-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .tg-slider {
    background-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
input:checked + .tg-slider:before {
    transform: translateX(22px);
}

.tg-switch-power input:checked + .tg-slider {
    background-color: var(--accent-green);
}

/* /* Working Levels Drawer & Main Terminal Corridor */
.working-levels-main-panel {
    box-sizing: border-box !important;
    width: 100% !important;
}

.wl-card-cell {
    min-width: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

.wl-card-label {
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.wl-card-val {
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-family: var(--font-mono, 'JetBrains Mono', monospace) !important;
    font-size: clamp(10px, 2.7vw, 15px) !important;
    font-weight: 900 !important;
    letter-spacing: -0.4px !important;
    line-height: 1.2 !important;
}

@media (max-width: 640px) {
    .wl-card-cell {
        padding: 5px 2px !important;
    }
    .wl-card-label {
        font-size: 8.5px !important;
        letter-spacing: -0.3px !important;
    }
    .wl-card-val {
        font-size: clamp(9.5px, 2.6vw, 12.5px) !important;
        letter-spacing: -0.6px !important;
    }
}

@media (max-width: 380px) {
    .wl-card-cell {
        padding: 4px 1px !important;
    }
    .wl-card-label {
        font-size: 7.5px !important;
        letter-spacing: -0.4px !important;
    }
    .wl-card-val {
        font-size: 9px !important;
        letter-spacing: -0.8px !important;
    }
}

.working-levels-panel {
    background: #090d14;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    padding: 14px;
    display: none;
}
.working-levels-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.working-levels-cell {
    background: #121824;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 6px 8px;
    text-align: center;
}
.working-levels-value {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 800;
    color: var(--accent-gold);
    margin-top: 2px;
}

/* Orderbook Depth Table */
.orderbook-table {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 11px;
    border-collapse: collapse;
}
.orderbook-table td {
    padding: 3px 6px;
}

/* Position & Stats Card */
.stat-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 11px;
}
.stat-label {
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10px;
}
.stat-value {
    font-family: var(--font-mono);
    font-weight: 800;
}

/* Emergency Action Buttons */
.action-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}
.btn-manual-exit {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--accent-gold);
    font-size: 10px;
    font-weight: 900;
    padding: 10px 6px;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.2s;
}
.btn-manual-exit:hover {
    background: var(--accent-gold);
    color: #000;
}

.btn-stop {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.4);
    color: var(--accent-red);
    font-size: 10px;
    font-weight: 900;
    padding: 10px 6px;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.2s;
}
.btn-stop:hover {
    background: var(--accent-red);
    color: #fff;
}

.btn-reset-sys {
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 900;
    padding: 10px 6px;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.2s;
}
.btn-reset-sys:hover {
    background: #334155;
    color: #fff;
}

/* Terminal Console Box */
.terminal-box {
    background: #080a0f;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 10px;
    height: 180px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 11px;
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.area-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 99999;
    overflow-y: auto;
    padding: 30px 15px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
}

.modal-body {
    background: linear-gradient(135deg, #131926 0%, #0c0f17 100%);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 16px;
    padding: 24px;
    max-width: 520px;
    width: 100%;
    height: auto !important;
    min-height: auto !important;
    margin: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9);
    box-sizing: border-box;
}

#toast-container {
    position: fixed !important;
    top: 72px !important;
    right: 20px !important;
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 380px;
}

.toast {
    min-width: 280px;
    max-width: 380px;
    padding: 12px 16px;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    backdrop-filter: blur(14px);
    animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.toast.toast-error {
    background: rgba(30, 12, 14, 0.97);
    border: 1px solid rgba(246, 70, 93, 0.6);
    color: #fca5a5;
    box-shadow: 0 4px 24px rgba(246, 70, 93, 0.35);
}

.toast.toast-success {
    background: rgba(6, 20, 14, 0.97);
    border: 1px solid rgba(46, 189, 133, 0.6);
    color: #6ee7b7;
    box-shadow: 0 4px 24px rgba(46, 189, 133, 0.3);
}

.toast.toast-warning {
    background: rgba(20, 15, 5, 0.97);
    border: 1px solid rgba(251, 191, 36, 0.6);
    color: #fcd34d;
    box-shadow: 0 4px 24px rgba(251, 191, 36, 0.3);
}

.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 900; font-size: 11px; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.toast-msg { font-size: 10px; opacity: 0.85; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.9); }
}

.modal-input {
    background: #090c12;
    border: 1px solid #1e293b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    width: 100%;
    outline: none;
}
.modal-input:focus {
    border-color: var(--accent-gold);
}

select {
    color-scheme: dark !important;
}

select option {
    background-color: #000000 !important;
    color: #ffffff !important;
}

.modal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.modal-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}
.modal-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.input-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.pnl-inr {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    margin-top: 2px;
}

.close-btn {
    cursor: pointer;
    position: absolute;
    top: 18px;
    right: 18px;
    color: #64748b;
    font-size: 18px;
    transition: 0.2s;
}
.close-btn:hover {
    color: #fff;
}

/* Preset Leverage Buttons */
.btn-lev-preset {
    background: #141b29;
    border: 1px solid #1e293b;
    color: #94a3b8;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 11px;
    padding: 6px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-lev-preset.active, .btn-lev-preset:hover {
    background: var(--accent-gold);
    color: #000;
    border-color: var(--accent-gold);
}

/* Range Slider */
.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #334155;
    outline: none;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gold);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-gold);
}

/* Time Input Fields */
.time-editor {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.time-part {
    background: #090c12;
    border: 1px solid #334155;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 800;
    text-align: center;
    width: 44px;
    height: 38px;
    border-radius: 6px;
    outline: none;
}
.time-part-label {
    font-size: 9px;
    font-weight: 800;
    color: #64748b;
    display: block;
    text-align: center;
    margin-bottom: 2px;
}

/* Restore Gate Modal */
.restore-gate-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999999;
    backdrop-filter: blur(14px);
    align-items: center;
    justify-content: center;
}
.restore-gate-overlay.visible {
    display: flex;
}
.restore-gate-modal {
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1217 100%);
    border: 2px solid rgba(251, 191, 36, 0.6);
    border-radius: 18px;
    padding: 36px 32px;
    max-width: 480px;
    width: 90%;
    text-align: center;
}
.restore-gate-icon { font-size: 42px; margin-bottom: 12px; }
.restore-gate-title { font-size: 20px; font-weight: 900; color: var(--accent-gold); margin-bottom: 8px; }
.restore-gate-subtitle { font-size: 12px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.restore-gate-info { background: #0b0e14; border: 1px solid #1e293b; padding: 10px; border-radius: 8px; font-family: var(--font-mono); font-size: 11px; color: #38bdf8; margin-bottom: 16px; }
.restore-gate-password-section { display: none; margin-bottom: 16px; }
.restore-gate-pw-label { font-size: 12px; font-weight: 800; color: #e2e8f0; margin-bottom: 6px; }
.restore-gate-pw-hint { font-size: 10px; color: #64748b; margin-bottom: 8px; }
.restore-gate-pw-input { background: #080a0f; border: 1px solid #334155; color: #fff; padding: 10px; border-radius: 8px; font-family: var(--font-mono); font-size: 16px; text-align: center; width: 100%; outline: none; }
.restore-gate-pw-error { color: #f43f5e; font-size: 11px; font-weight: 800; display: none; margin-top: 6px; }
.restore-gate-buttons { display: flex; gap: 12px; }
.restore-gate-btn-fresh { flex: 1; background: #10b981; color: #000; font-weight: 900; font-size: 12px; padding: 12px; border-radius: 8px; border: none; cursor: pointer; text-transform: uppercase; }
.restore-gate-btn-continue { flex: 1; background: var(--accent-gold); color: #000; font-weight: 900; font-size: 12px; padding: 12px; border-radius: 8px; border: none; cursor: pointer; text-transform: uppercase; }

/* ==========================================================================
   FULLSCREEN MODALS (Chart, Logs & Cycles)
   ========================================================================== */
.fullscreen-chart-modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    min-width: 100vw !important;
    height: 100% !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    background: #070a10 !important;
    z-index: 9999999 !important;
    flex-direction: column;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
}

.fullscreen-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #0f141f;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}

.fullscreen-chart-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
}

.close-fullscreen-btn {
    background: rgba(244, 63, 94, 0.15);
    border: 1.5px solid #f43f5e;
    color: #f43f5e;
    font-weight: 900;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
}
.close-fullscreen-btn:hover {
    background: #f43f5e;
    color: #fff;
}

.cycles-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 11, 16, 0.95);
    backdrop-filter: blur(14px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.fullscreen-chart-canvas-wrapper {
    flex: 1;
    min-height: 400px;
    position: relative;
}

/* Hidden Utility */
.hidden-compat {
    display: none !important;
}

/* ==========================================================================
   LEFT SLIDE-OUT CONTROLS SIDEBAR (Pankaj Automation Style)
   ========================================================================== */
.controls-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    width: 380px;
    max-width: 90vw;
    z-index: 99998 !important;
    background: #0c1017 !important;
    background-color: #0c1017 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.95);
}

.controls-sidebar.open {
    transform: translateX(0);
}

/* Floating Tab Button Attached to Right Edge of the Left Drawer */
.controls-sidebar-toggle {
    position: absolute;
    right: -36px;
    top: 20px;
    width: 36px;
    height: 86px;
    padding: 10px 0;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-left: none;
    border-radius: 0 10px 10px 0;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(59, 130, 246, 0.35);
    transition: all 0.2s ease;
    z-index: 99999 !important;
    box-sizing: border-box;
}

.controls-sidebar-toggle:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
    box-shadow: 6px 4px 20px rgba(59, 130, 246, 0.5);
    right: -38px;
}

.controls-sidebar-toggle i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.controls-sidebar.open .controls-sidebar-toggle i {
    transform: rotate(180deg);
}

/* ==========================================================================
   RIGHT SLIDE-OUT LOGS SIDEBAR (Pankaj Automation Style)
   ========================================================================== */
.logs-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    z-index: 99998 !important;
    background: #0c1017 !important;
    background-color: #0c1017 !important;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.95);
}

.logs-sidebar.open {
    transform: translateX(0);
}

/* Floating Tab Button Attached to Left Edge of the Drawer */
.logs-sidebar-toggle {
    position: absolute;
    left: -36px;
    top: 20px;
    width: 36px;
    height: 86px;
    padding: 10px 0;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-right: none;
    border-radius: 10px 0 0 10px;
    color: #000000;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: -4px 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(245, 158, 11, 0.35);
    transition: all 0.2s ease;
    z-index: 99999 !important;
    box-sizing: border-box;
}

.logs-sidebar-toggle:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: -6px 4px 20px rgba(245, 158, 11, 0.5);
    left: -38px;
}

.logs-sidebar-toggle i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.logs-sidebar.open .logs-sidebar-toggle i {
    transform: rotate(180deg);
}

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.5px;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
}

.sidebar-inner {
    width: 100%;
    height: 100%;
    position: relative;
    background: #0c1017 !important;
    background-color: #0c1017 !important;
}

#sidebar-log-content {
    background: #070a0f !important;
    background-color: #070a0f !important;
}

.sidebar-filter-btn {
    padding: 3px 8px;
    font-size: 9px;
    font-weight: 800;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
}

.sidebar-filter-btn.active, .sidebar-filter-btn:hover {
    background: #f59e0b;
    color: #000;
    border-color: #f59e0b;
}

/* ==========================================================================
   DYNAMIC RESPONSIVE MAIN CONTENT RESIZING (Pankaj Automation Style)
   ========================================================================== */
:root {
    --controls-sidebar-width: 360px;
    --logs-sidebar-width: 380px;
}

#main-content-container, .pane-card {
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

body.controls-sidebar-open #main-content-container {
    margin-left: var(--controls-sidebar-width, 360px) !important;
    width: calc(100% - var(--controls-sidebar-width, 360px)) !important;
    max-width: calc(100% - var(--controls-sidebar-width, 360px)) !important;
}

body.logs-sidebar-open #main-content-container {
}

/* Hidden Utility */
.hidden-compat {
    display: none !important;
}

/* ==========================================================================
   LEFT SLIDE-OUT CONTROLS SIDEBAR (Pankaj Automation Style)
   ========================================================================== */
.controls-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    width: 360px;
    max-width: 90vw;
    z-index: 99998 !important;
    background: #0c1017 !important;
    background-color: #0c1017 !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.95);
}

.controls-sidebar.open {
    transform: translateX(0);
}

/* Floating Tab Button Attached to Right Edge of the Left Drawer */
.controls-sidebar-toggle {
    position: absolute;
    right: -36px;
    top: 20px;
    width: 36px;
    height: 86px;
    padding: 10px 0;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-left: none;
    border-radius: 0 10px 10px 0;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(59, 130, 246, 0.35);
    transition: all 0.2s ease;
    z-index: 99999 !important;
    box-sizing: border-box;
}

.controls-sidebar-toggle:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
    box-shadow: 6px 4px 20px rgba(59, 130, 246, 0.5);
    right: -38px;
}

.controls-sidebar-toggle i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.controls-sidebar.open .controls-sidebar-toggle i {
    transform: rotate(180deg);
}

/* ==========================================================================
   RIGHT SLIDE-OUT LOGS SIDEBAR (Pankaj Automation Style)
   ========================================================================== */
.logs-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    z-index: 99998 !important;
    background: #0c1017 !important;
    background-color: #0c1017 !important;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.95);
}

.logs-sidebar.open {
    transform: translateX(0);
}

/* Floating Tab Button Attached to Left Edge of the Drawer */
.logs-sidebar-toggle {
    position: absolute;
    left: -36px;
    top: 20px;
    width: 36px;
    height: 86px;
    padding: 10px 0;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-right: none;
    border-radius: 10px 0 0 10px;
    color: #000000;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: -4px 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(245, 158, 11, 0.35);
    transition: all 0.2s ease;
    z-index: 99999 !important;
    box-sizing: border-box;
}

.logs-sidebar-toggle:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: -6px 4px 20px rgba(245, 158, 11, 0.5);
    left: -38px;
}

.logs-sidebar-toggle i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.logs-sidebar.open .logs-sidebar-toggle i {
    transform: rotate(180deg);
}

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.5px;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
}

.sidebar-inner {
    width: 100%;
    height: 100%;
    position: relative;
    background: #0c1017 !important;
    background-color: #0c1017 !important;
}

#sidebar-log-content {
    background: #070a0f !important;
    background-color: #070a0f !important;
}

.sidebar-filter-btn {
    padding: 3px 8px;
    font-size: 9px;
    font-weight: 800;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    cursor: pointer;
    transition: 0.2s;
    text-transform: uppercase;
}

.sidebar-filter-btn.active, .sidebar-filter-btn:hover {
    background: #f59e0b;
    color: #000;
    border-color: #f59e0b;
}

/* ==========================================================================
   DYNAMIC RESPONSIVE MAIN CONTENT RESIZING (Pankaj Automation Style)
   ========================================================================== */
:root {
    --controls-sidebar-width: 360px;
    --logs-sidebar-width: 380px;
}

#main-content-container, .pane-card {
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

body.controls-sidebar-open #main-content-container {
    margin-left: var(--controls-sidebar-width, 360px) !important;
    width: calc(100% - var(--controls-sidebar-width, 360px)) !important;
    max-width: calc(100% - var(--controls-sidebar-width, 360px)) !important;
}

body.logs-sidebar-open #main-content-container {
    margin-right: var(--logs-sidebar-width, 380px) !important;
    width: calc(100% - var(--logs-sidebar-width, 380px)) !important;
    max-width: calc(100% - var(--logs-sidebar-width, 380px)) !important;
}

body.controls-sidebar-open.logs-sidebar-open #main-content-container {
    margin-left: var(--controls-sidebar-width, 360px) !important;
    margin-right: var(--logs-sidebar-width, 380px) !important;
    width: calc(100% - var(--controls-sidebar-width, 360px) - var(--logs-sidebar-width, 380px)) !important;
    max-width: calc(100% - var(--controls-sidebar-width, 360px) - var(--logs-sidebar-width, 380px)) !important;
}

@media (max-width: 1024px) {
    body.controls-sidebar-open #main-content-container,
    body.logs-sidebar-open #main-content-container,
    body.controls-sidebar-open.logs-sidebar-open #main-content-container {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ==========================================================================
   DESKTOP DEFAULT: HIDE MOBILE DOCKS & SETUP SIDEBAR BACKDROP
   ========================================================================== */
.mobile-top-dock,
.mobile-bottom-dock {
    display: none !important;
}

#mobile-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9990;
    display: none;
}

@media (max-width: 1024px) {
    body.controls-sidebar-open #mobile-sidebar-backdrop,
    body.logs-sidebar-open #mobile-sidebar-backdrop {
        display: block !important;
    }
}

/* ==========================================================================
   100% UNIFIED RESPONSIVE TRADING UI (PC & MOBILE COMPATIBLE)
   ========================================================================== */
@media (max-width: 768px) {
    /* 0. Mobile Screen Fill: Remove excessive black side gutters */
    #main-content-container {
        padding-left: 4px !important;
        padding-right: 4px !important;
        padding-top: 6px !important;
        padding-bottom: 12px !important;
        gap: 6px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .pane-card {
        padding: 10px 8px !important;
        border-radius: 8px !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .big-stats-box {
        padding: 10px 8px !important;
        border-radius: 8px !important;
    }

    .control-grid {
        gap: 6px !important;
    }

    /* 1. Dedicated Mobile Top Bar Dock (Sandeep Crypto Machine) */
    .mobile-top-dock {
        display: flex !important;
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 38px !important;
        min-height: 38px !important;
        background: #070b14 !important;
        border-bottom: 1.5px solid #f59e0b !important;
        box-shadow: 0 4px 25px rgba(0, 0, 0, 0.95) !important;
        z-index: 1000 !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 4px 16px !important;
        padding-top: max(4px, env(safe-area-inset-top, 4px)) !important;
        box-sizing: border-box !important;
    }

    .mobile-top-dock .brand-logo {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        line-height: 1 !important;
        font-family: var(--font-ui) !important;
        font-weight: 900 !important;
        font-size: 15.5px !important;
        letter-spacing: 0.5px !important;
        background: linear-gradient(135deg, #fde047 0%, #fbbf24 45%, #f59e0b 80%, #ea580c 100%) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
    }

    .mobile-top-dock .brand-logo i {
        font-size: 16px !important;
        color: #fbbf24 !important;
        -webkit-text-fill-color: #fbbf24 !important;
        filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6)) !important;
    }

    .mobile-top-dock .brand-name {
        font-size: 15px !important;
        font-weight: 900 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }

    .pro-header {
        height: auto !important;
        min-height: auto !important;
        padding: 6px 4px !important;
        background: rgba(11, 14, 20, 0.95) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: none !important;
        position: static !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .pro-header .header-brand-row {
        display: none !important;
    }

    .header-controls {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        padding: 4px 6px !important;
        margin-top: 0 !important;
        background: transparent !important;
        border: none !important;
        box-sizing: border-box !important;
    }

    .header-controls .pill-box,
    .header-controls button {
        padding: 3px 7px !important;
        font-size: 10.5px !important;
        height: 26px !important;
        flex-shrink: 0 !important;
        border-radius: 6px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .mode-toggle {
        padding: 2px !important;
        height: 26px !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    .mode-btn {
        padding: 3px 9px !important;
        font-size: 10px !important;
        height: 22px !important;
        line-height: 22px !important;
    }

    #live-clock {
        height: 26px !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    /* 2. Sidebars - Accessible on mobile via same floating toggle tabs */
    .controls-sidebar, .logs-sidebar {
        width: min(340px, 88vw) !important;
        top: 30px !important;
        bottom: 40px !important;
        height: calc(100vh - 30px - 40px) !important;
        height: calc(100dvh - 30px - 40px) !important;
        z-index: 99998 !important;
        background: #0c1017 !important;
        background-color: #0c1017 !important;
        box-shadow: 0 0 50px rgba(0,0,0,0.98) !important;
    }

    .controls-sidebar-toggle, .logs-sidebar-toggle {
        display: flex !important;
        top: 25px !important;
        width: 34px !important;
        height: 80px !important;
        z-index: 99999 !important;
    }

    /* 3. Action Toolbar & Working Levels */
    .action-toolbar {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .action-toolbar button:first-child {
        grid-column: span 2 !important;
        padding: 10px !important;
        font-size: 13px !important;
        font-weight: 900 !important;
    }

    .working-levels-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    /* 4. Coin Switch Card & Action Pills Mobile Styling */
    .pair-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .pair-header-main {
        width: 100% !important;
    }

    .pair-header-actions-row {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 5px !important;
    }

    .coin-action-btn,
    .coin-select-box,
    .coin-trading-pill {
        height: 26px !important;
        font-size: 10.5px !important;
        padding: 2px 8px !important;
        flex-shrink: 0 !important;
        border-radius: 6px !important;
    }

    .coin-details-row {
        padding-left: 0 !important;
        font-size: 9.5px !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    .pair-price {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
        padding-top: 8px !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    }

    .pair-price .price-main-row,
    .pair-price > div {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
    }

    /* 5. Modals & Popups Mobile Centering (Clean Floating Card Popup) */
    .area-modal,
    .cycles-modal-overlay {
        display: none;
        align-items: center !important;
        justify-content: center !important;
        padding: 16px !important;
        background: rgba(0, 0, 0, 0.85) !important;
        backdrop-filter: blur(12px) !important;
        z-index: 999999 !important;
        box-sizing: border-box !important;
    }

    .area-modal .modal-body,
    .cycles-modal-overlay > div,
    .cycles-modal-overlay .modal-body {
        width: 100% !important;
        max-width: 580px !important;
        border-radius: 16px !important;
        margin: auto !important;
        padding: 18px 16px !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
        background: #0f172a !important;
        border: 1px solid rgba(245, 158, 11, 0.25) !important;
        box-sizing: border-box !important;
        max-height: calc(100dvh - 60px) !important;
        overflow-y: auto !important;
    }

    .fullscreen-chart-modal {
        position: fixed !important;
        top: 30px !important;
        bottom: 40px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: calc(100vh - 30px - 40px) !important;
        height: calc(100dvh - 30px - 40px) !important;
        max-height: calc(100dvh - 30px - 40px) !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #070a10 !important;
        z-index: 999999 !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
    }

    .fullscreen-chart-header {
        height: auto !important;
        min-height: 52px !important;
        padding: 8px 14px !important;
    }

    .fullscreen-chart-body {
        padding: 8px 12px !important;
        gap: 8px !important;
        height: auto !important;
    }

    .fs-log-header-container {
        padding-top: max(12px, env(safe-area-inset-top, 12px)) !important;
        padding-left: max(12px, env(safe-area-inset-left, 12px)) !important;
        padding-right: max(12px, env(safe-area-inset-right, 12px)) !important;
        padding-bottom: 8px !important;
        gap: 8px !important;
    }

    /* Range Modal: Stack Start Time and End Time cards vertically on mobile */
    #time-range-inputs-btc,
    #manual-range-inputs-btc,
    [id*="time-range-inputs"],
    [id*="manual-range-inputs"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* 6. Mobile Fixed Bottom Menu with Prominent Maker PnL */
    .mobile-bottom-dock {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 40px !important;
        background: #070b14 !important;
        border-top: 1.5px solid #f59e0b !important;
        border-radius: 0 !important;
        box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.95) !important;
        z-index: 10000000 !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 0 12px !important;
        box-sizing: border-box !important;
    }

    .mobile-dock-maker-label {
        font-size: 11px !important;
        font-weight: 900 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.8px !important;
        color: #facc15 !important;
    }

    .mobile-dock-maker-val {
        font-size: 16px !important;
        font-weight: 900 !important;
        letter-spacing: 0.5px !important;
        color: #facc15;
        transition: color 0.2s ease;
    }

    body {
        padding-top: 0 !important;
        padding-bottom: 44px !important;
    }
}

/* ==========================================================================
   UNIVERSAL MODAL & DRAWER CLOSE BUTTONS (Bold Red Background with Crisp White X)
   ========================================================================== */
.modal-close-btn,
.close-fullscreen-btn,
.close-btn,
.side-drawer-header button[onclick*="toggle"],
.area-modal .modal-header button[onclick*="hideM"],
.area-modal .modal-body > div:first-child > button[onclick*="hideM"],
.area-modal .modal-body > div:first-child > button[onclick*="close"],
.area-modal .modal-content > div:first-child > button[onclick*="hideM"],
.area-modal .modal-content > div:first-child > button[onclick*="close"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    background: #ef4444 !important; /* Bold Red Background */
    color: #ffffff !important;      /* Crisp Pure White X */
    border: 1.5px solid #dc2626 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 99999 !important;
    transition: all 0.15s ease !important;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.45) !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5) !important;
}

.modal-close-btn:hover,
.close-fullscreen-btn:hover,
.close-btn:hover,
.side-drawer-header button[onclick*="toggle"]:hover,
.area-modal .modal-header button[onclick*="hideM"]:hover,
.area-modal .modal-body > div:first-child > button[onclick*="hideM"]:hover,
.area-modal .modal-body > div:first-child > button[onclick*="close"]:hover,
.area-modal .modal-content > div:first-child > button[onclick*="hideM"]:hover,
.area-modal .modal-content > div:first-child > button[onclick*="close"]:hover {
    background: #dc2626 !important;
    border-color: #b91c1c !important;
    color: #ffffff !important;
    transform: scale(1.08) !important;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.65) !important;
}

.modal-close-btn:active,
.close-fullscreen-btn:active {
    transform: scale(0.95) !important;
}

/* Universal Number Input Spinners Reset */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* ==========================================================================
   TOAST NOTIFICATIONS (Positioned safely above bottom dock on mobile)
   ========================================================================== */
#toast-container {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 100000050 !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    gap: 10px !important;
    pointer-events: none !important;
    max-width: 380px !important;
}

@media (max-width: 768px) {
    #toast-container {
        bottom: 56px !important; /* Positioned safely above the 40px Net PnL dock */
        left: 12px !important;
        right: 12px !important;
        max-width: calc(100% - 24px) !important;
    }
}

/* ==========================================================================
   VIEW ONLY / EDIT MODE STYLES
   ========================================================================== */
/* In View Only Mode, input boxes remain 100% crystal clear and visible to read numbers */
body.view-only-mode input:not([id*="search"]):not([id*="filter"]),
body.view-only-mode select,
body.view-only-mode textarea,
body.view-only-mode .time-editor {
    cursor: default !important;
    pointer-events: none !important;
    opacity: 1 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    filter: none !important;
}

body.view-only-mode input::placeholder,
body.view-only-mode textarea::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #94a3b8 !important;
}

/* Switches & Sliders in View Only Mode */
body.view-only-mode .tg-switch,
body.view-only-mode .tg-slider,
body.view-only-mode .mode-toggle,
body.view-only-mode .range-slider {
    cursor: default !important;
    pointer-events: none !important;
    opacity: 0.85 !important;
}

/* Action, Save, Reset and Square-Off buttons locked and dimmed */
body.view-only-mode button[onclick*="save"],
body.view-only-mode button[onclick*="Save"],
body.view-only-mode button[id*="save"],
body.view-only-mode button[id*="Save"],
body.view-only-mode button[onclick*="Square"],
body.view-only-mode button[onclick*="square"],
body.view-only-mode button[onclick*="Reset"],
body.view-only-mode button[onclick*="reset"],
body.view-only-mode button[onclick*="Clear"],
body.view-only-mode button[onclick*="clear"],
body.view-only-mode button[onclick*="Stop"],
body.view-only-mode button[onclick*="stop"],
body.view-only-mode button[onclick*="triggerBackendRestart"],
body.view-only-mode button[onclick*="clearOldCacheAndReload"],
body.view-only-mode button[onclick*="clearLogs"],
body.view-only-mode button[onclick*="resetMTMStats"],
body.view-only-mode button[onclick*="resetChart"],
body.view-only-mode .btn-lev-preset,
body.view-only-mode .modal-save-btn,
body.view-only-mode #save-logic-btc,
body.view-only-mode #tg-btn-save,
body.view-only-mode .coin-select-box,
body.view-only-mode #symbol-selector,
body.view-only-mode #custom-symbol-container {
    cursor: not-allowed !important;
    pointer-events: none !important;
    user-select: none !important;
    opacity: 0.4 !important;
    filter: grayscale(0.85) !important;
}

body.view-only-mode .coin-select-box select,
body.view-only-mode .coin-select-box label {
    cursor: not-allowed !important;
    pointer-events: none !important;
    color: #64748b !important;
}

/* Allow modal close buttons and toggles to remain interactive in View Only mode */
body.view-only-mode .modal-close-btn,
body.view-only-mode .close-modal-btn,
body.view-only-mode #ui-mode-toggle-btn,
body.view-only-mode #ui-mode-toggle-btn-mobile,
body.view-only-mode .ui-mode-blink-badge,
body.view-only-mode .controls-sidebar-toggle,
body.view-only-mode .logs-sidebar-toggle {
    pointer-events: auto !important;
    cursor: pointer !important;
    opacity: 1 !important;
}

/* ==========================================================================
   VIEW ONLY & EDIT MODE DISTINCT 3D ANIMATED BADGES (Next to Brand Title)
   ========================================================================== */

/* 1. VIEW ONLY (Locked Safe Mode - Fiery Ruby Red & Amber Gold) */
.ui-mode-blink-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3.5px 11px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    cursor: pointer !important;
    border: 1.5px solid rgba(244, 63, 94, 0.85);
    background: linear-gradient(135deg, rgba(225, 29, 72, 0.22) 0%, rgba(180, 83, 9, 0.35) 100%);
    color: #f87171;
    text-shadow: 0 0 8px rgba(244, 63, 94, 0.5);
    box-shadow: 0 0 16px rgba(225, 29, 72, 0.35);
    animation: viewOnlyRubyPulse 2.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.ui-mode-blink-badge:hover {
    border-color: #f87171;
    box-shadow: 0 0 22px rgba(244, 63, 94, 0.65);
    transform: translateY(-0.5px);
}

.ui-mode-blink-badge .blink-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #f43f5e;
    box-shadow: 0 0 9px #f43f5e, 0 0 16px rgba(244, 63, 94, 0.9);
    animation: blinkIndicator 1.1s ease-in-out infinite;
}

/* 3D Animated Lock Symbol (View Only - Gold to Red Metallic Gradient) */
.ui-mode-blink-badge .ui-mode-icon-shared {
    display: inline-block;
    font-size: 11px;
    background: linear-gradient(180deg, #fef08a 0%, #fbbf24 45%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 7px rgba(245, 158, 11, 0.8));
    animation: lock3DShake 3s ease-in-out infinite;
    transform-origin: center center;
}

@keyframes lock3DShake {
    0%, 100% {
        transform: perspective(250px) rotateY(0deg) scale(1.1);
    }
    15% {
        transform: perspective(250px) rotateY(-18deg) rotateZ(-4deg) scale(1.18);
    }
    30% {
        transform: perspective(250px) rotateY(18deg) rotateZ(4deg) scale(1.18);
    }
    45% {
        transform: perspective(250px) rotateY(-8deg) scale(1.12);
    }
    60% {
        transform: perspective(250px) rotateY(0deg) scale(1.1);
    }
}

@keyframes viewOnlyRubyPulse {
    0%, 100% {
        border-color: rgba(244, 63, 94, 0.9);
        box-shadow: 0 0 18px rgba(225, 29, 72, 0.45);
    }
    50% {
        border-color: rgba(244, 63, 94, 0.35);
        box-shadow: 0 0 6px rgba(225, 29, 72, 0.15);
    }
}

/* 2. EDIT MODE (Unlocked Active Mode - Electric Cyber Neon Emerald) */
body.edit-mode-active .ui-mode-blink-badge {
    border: 1.5px solid rgba(52, 211, 153, 0.95);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.28) 0%, rgba(4, 120, 87, 0.45) 100%);
    color: #34d399;
    text-shadow: 0 0 8px rgba(52, 211, 153, 0.55);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    animation: editModeCyberPulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

body.edit-mode-active .ui-mode-blink-badge:hover {
    border-color: #34d399;
    box-shadow: 0 0 26px rgba(52, 211, 153, 0.75);
    transform: translateY(-0.5px);
}

body.edit-mode-active .ui-mode-blink-badge .blink-dot {
    background-color: #10b981;
    box-shadow: 0 0 10px #10b981, 0 0 18px rgba(16, 185, 129, 0.95);
}

/* 3D Animated Unlock Symbol (Edit Mode - Mint to Emerald Metallic Gradient) */
body.edit-mode-active .ui-mode-blink-badge .ui-mode-icon-shared {
    background: linear-gradient(180deg, #d1fae5 0%, #34d399 40%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 8px rgba(52, 211, 153, 0.85));
    animation: unlock3DFloat 2s ease-in-out infinite;
    transform-origin: center center;
}

@keyframes unlock3DFloat {
    0%, 100% {
        transform: perspective(250px) translateY(0) rotateZ(-6deg) scale(1.15);
    }
    50% {
        transform: perspective(250px) translateY(-2px) rotateZ(-14deg) scale(1.25);
    }
}

@keyframes editModeCyberPulse {
    0%, 100% {
        border-color: rgba(52, 211, 153, 1);
        box-shadow: 0 0 22px rgba(16, 185, 129, 0.6);
    }
    50% {
        border-color: rgba(52, 211, 153, 0.4);
        box-shadow: 0 0 7px rgba(16, 185, 129, 0.2);
    }
}

/* Visual border glow when Edit Mode is active */
body.edit-mode-active .pro-header {
    border-bottom: 1.5px solid rgba(16, 185, 129, 0.7);
    box-shadow: 0 4px 25px -2px rgba(16, 185, 129, 0.25);
}
