:root {
    /* Color Palette matching Algo Bot */
    --sidebar-bg: linear-gradient(180deg, #110326 0%, #1e0545 35%, #2a0760 70%, #170238 100%);
    --sidebar-active: rgba(255, 255, 255, 0.16);
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-text: #e2d9f3;
    --sidebar-text-muted: #a796c9;

    --bg-main: #f8fafc;
    --panel-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;

    --accent-purple: #3b0764;
    --accent-purple-light: #581c87;
    --accent-purple-gradient: linear-gradient(90deg, #3b0764 0%, #1e1b4b 100%);
    --accent-blue: #2563eb;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Trade Status Colors */
    --profit: #16a34a;
    --profit-bg: #dcfce7;
    --loss: #dc2626;
    --loss-bg: #fee2e2;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --info-bg: #e0f2fe;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Roboto Mono', monospace;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* Utilities */
.flex { display: flex; }
.flex-column { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.w-100 { width: 100%; }
.mono { font-family: var(--font-mono); }
.text-profit { color: var(--profit) !important; font-weight: 600; }
.text-loss { color: var(--loss) !important; font-weight: 600; }
.text-muted { color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    outline: none;
    text-decoration: none;
}
.btn-primary {
    background: var(--accent-purple);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--accent-purple-light);
    box-shadow: 0 4px 12px rgba(59, 7, 100, 0.25);
}
.btn-gradient {
    background: var(--accent-purple-gradient);
    color: #ffffff;
    font-weight: 600;
}
.btn-gradient:hover {
    opacity: 0.95;
    box-shadow: 0 4px 14px rgba(30, 27, 75, 0.3);
}
.btn-secondary {
    background: #ffffff;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-primary);
}
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.35rem 0.5rem;
}
.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}
.btn-sm {
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
}
.btn-xs {
    font-size: 0.72rem;
    padding: 0.18rem 0.45rem;
    border-radius: 4px;
}
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon-green {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}
.btn-icon-green:hover { background: #bbf7d0; }
.btn-icon-red {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.btn-icon-red:hover { background: #fecaca; }

/* Form Controls */
.input-group { margin-bottom: 1rem; }
.input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    transition: all 0.15s;
}
input:focus, select:focus {
    border-color: var(--accent-purple-light);
    box-shadow: 0 0 0 3px rgba(88, 28, 135, 0.12);
    outline: none;
}

/* Badges & Chips */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-blue { background: #eff6ff; color: #2563eb; border: 1px solid #dbeafe; }
.badge-purple { background: #faf5ff; color: #7e22ce; border: 1px solid #f3e8ff; }
.badge-green { background: var(--profit-bg); color: var(--profit); border: 1px solid #bbf7d0; }
.badge-red { background: var(--loss-bg); color: var(--loss); border: 1px solid #fecaca; }
.badge-orange { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }

.param-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.73rem;
    padding: 0.2rem 0.5rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
}
.param-chip strong { color: var(--text-primary); }
.param-chip.delta-buy { background: #fef2f2; color: #ef4444; border-color: #fee2e2; }
.param-chip.delta-sell { background: #f0fdf4; color: #16a34a; border-color: #dcfce7; }

/* Switch Toggle */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: 0.2s;
    border-radius: 22px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background-color: #10b981;
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ========================================================
   Sidebar (Deep Purple Gradient)
   ======================================================== */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    color: #ffffff;
    user-select: none;
    position: relative;
    z-index: 20;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
}

.sidebar-header {
    padding: 1.75rem 1.25rem 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mobile-sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
    line-height: 1;
}
.mobile-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 998;
}
.sidebar-backdrop.active {
    display: block;
}

/* Sci-fi Futuristic Logo */
.brand-logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.brand-logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
}
.brand-badge-ai {
    font-size: 0.68rem;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid #38bdf8;
    padding: 1px 6px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.85rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.7rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--sidebar-text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
}
.nav-item:hover {
    color: #ffffff;
    background: var(--sidebar-hover);
}
.nav-item.active {
    color: #ffffff;
    background: var(--sidebar-active);
    font-weight: 600;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}
.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 1rem 0.85rem 0.5rem 0.85rem;
}
.logout-btn-pill {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 1rem;
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.logout-btn-pill:hover {
    background: rgba(220, 38, 38, 0.25);
    color: #ffffff;
    border-color: #ef4444;
}

.sidebar-credit {
    padding: 0.75rem 1rem;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ========================================================
   Main Content Area
   ======================================================== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-main);
}

/* Top Navbar */
.top-navbar {
    height: 64px;
    min-height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}
.navbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.35rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}
.mobile-menu-btn:hover {
    background: #f1f5f9;
}
.user-greeting {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.navbar-center-ticker {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.ticker-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    background: #f1f5f9;
}
.ticker-pill.green { background: #dcfce7; color: #15803d; }
.ticker-pill.red { background: #fee2e2; color: #b91c1c; }

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-avatar-glow {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8 0%, #a855f7 100%);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #1e1b4b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Scrollable View Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}
.view-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ========================================================
   1. Dashboard Overview Cards Grid (dash.png)
   ======================================================== */
.stats-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}


.stat-card-modern {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.15rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.stat-icon-box {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.stat-details label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}
.stat-details .stat-number {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* ========================================================
   2. Strategies / Webhooks Grid (strategy.png)
   ======================================================== */
.strategies-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}


.strategy-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    transition: box-shadow 0.2s, transform 0.15s;
}
.strategy-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

.strategy-card-header {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px dashed var(--border-color);
}
.strategy-card-header .title-area {
    flex: 1;
    min-width: 0;
    padding-right: 0.75rem;
}
.strategy-card-header .st-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.strategy-card-header .st-index {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.strategy-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.strategy-card-body {
    padding: 1.15rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.9rem;
}
.strategy-desc-text {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.45;
    min-height: 2.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.strategy-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.75rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.strategy-meta-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.strategy-meta-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.strategy-meta-val {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

/* Strategy Card Bottom Tabs */
.strategy-card-footer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--border-color);
}
.st-footer-tab {
    padding: 0.65rem 0.25rem;
    text-align: center;
    background: #f8fafc;
    border: none;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-right: 1px solid var(--border-color);
}
.st-footer-tab:last-child { border-right: none; }
.st-footer-tab:hover { background: #f1f5f9; color: var(--text-primary); }
.st-footer-tab.active-purple {
    background: #3b0764;
    color: #ffffff;
    font-weight: 600;
}
.st-footer-tab.active-purple:hover { background: #581c87; }

/* ========================================================
   3. Manage Broker (broker.png)
   ======================================================== */
.broker-container {
    max-width: 900px;
    margin: 0 auto;
}
.broker-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.expiring-countdown-card {
    background: #1e1b4b;
    color: #ffffff;
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(30, 27, 75, 0.2);
}
.expiring-countdown-card .label {
    font-size: 0.7rem;
    color: #a5b4fc;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.countdown-digits {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #38bdf8;
}

.broker-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}
.broker-header-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
.broker-logo-box {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}
.broker-title-group h3 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.broker-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
}
.broker-help-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-top: 2px;
    display: inline-block;
}
.broker-help-link:hover { color: var(--accent-purple-light); }

/* ========================================================
   4. Trades & Performance View (trade.png)
   ======================================================== */
.trade-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.trade-summary-box {
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid transparent;
}
.trade-summary-box.green { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.trade-summary-box.red { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.trade-summary-box.blue { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.trade-summary-box.yellow { background: #fefce8; border-color: #fef08a; color: #854d0e; }

.trade-summary-box .box-label {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}
.trade-summary-box .box-value {
    font-size: 1.35rem;
    font-weight: 800;
    font-family: var(--font-mono);
}
.trade-summary-box .box-percent {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.8;
}

.trade-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.trade-filter-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.trade-filter-left select {
    width: 220px;
}
.trade-filter-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.date-filter-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.date-filter-item input[type="date"] {
    width: 140px;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Modern Data Table */
.table-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    text-align: left;
}
.modern-table thead {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}
.modern-table th {
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.modern-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    white-space: nowrap;
}
.modern-table tbody tr:hover {
    background: #f8fafc;
}
.modern-table .mono {
    font-family: var(--font-mono);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}
.modal-body {
    padding: 1.5rem;
}

/* Auth Center Screen */
.auth-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #240a5e 0%, #110326 100%);
}
.auth-box-modern {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 430px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.auth-box-modern .brand-header {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-tabs-modern {
    display: flex;
    margin-bottom: 1.75rem;
    border-bottom: 2px solid #f1f5f9;
}
.auth-tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 0.65rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.auth-tab-btn.active {
    color: var(--accent-purple);
    border-bottom-color: var(--accent-purple);
    font-weight: 700;
}

/* ========================================================
   RESPONSIVE DESIGN (Desktops & Large Tablets < 1200px)
   ======================================================== */
@media (max-width: 1200px) {
    .stats-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.15rem;
    }
    .strategies-grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.15rem;
    }
}

/* ========================================================
   RESPONSIVE DESIGN (Tablets < 1024px)
   ======================================================== */
@media (max-width: 1024px) {
    .top-navbar {
        padding: 0 1.25rem;
    }
    .navbar-center-ticker {
        gap: 0.5rem;
    }
    .ticker-pill {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    .main-content {
        padding: 1.5rem;
    }
    .trade-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* ========================================================
   RESPONSIVE DESIGN (Mobile Devices < 768px)
   ======================================================== */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
    }

    .app-container {
        position: relative;
        height: 100vh;
        overflow: hidden;
    }

    /* Mobile Drawer Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 275px;
        max-width: 82vw;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.45);
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    .mobile-sidebar-close {
        display: flex;
    }
    .mobile-menu-btn {
        display: flex;
    }

    /* Top Navbar */
    .top-navbar {
        height: 58px;
        min-height: 58px;
        padding: 0 1rem;
    }
    .user-greeting {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 160px;
    }
    .navbar-center-ticker {
        display: none; /* Hide ticker on mobile to prevent navbar crowding */
    }
    .navbar-right {
        gap: 0.5rem;
    }
    .btn-change-pwd {
        display: none; /* Available in Settings tab on mobile */
    }

    /* Main Content Area */
    .main-wrapper {
        width: 100vw;
        height: 100vh;
    }
    .main-content {
        padding: 1rem 0.85rem 2.5rem 0.85rem;
        -webkit-overflow-scrolling: touch;
    }

    .view-header {
        margin-bottom: 1.15rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .view-title {
        font-size: 1.2rem;
    }

    /* Dashboard Stats (Clean 2-Column on Mobile) */
    .stats-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .stat-card-modern {
        padding: 0.85rem 0.75rem;
        gap: 0.75rem;
    }
    .stat-icon-box {
        width: 38px;
        height: 38px;
        font-size: 1.15rem;
        flex-shrink: 0;
    }
    .stat-details label {
        font-size: 0.7rem;
    }
    .stat-details .stat-number {
        font-size: 1.15rem;
    }

    /* Strategies Grid */
    .strategies-grid-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .strategy-card-header {
        padding: 0.85rem 1rem;
    }
    .strategy-card-body {
        padding: 1rem;
    }
    .strategy-meta-grid {
        padding: 0.65rem 0.75rem;
        gap: 0.35rem;
    }
    .strategy-meta-label {
        font-size: 0.62rem;
    }
    .strategy-meta-val {
        font-size: 0.82rem;
    }

    /* Manage Broker */
    .broker-container {
        width: 100%;
    }
    .broker-card {
        padding: 1.25rem 1rem;
    }
    .broker-top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
    }
    .expiring-countdown-card {
        padding: 0.65rem 1rem;
    }
    .countdown-digits {
        font-size: 1rem;
        letter-spacing: 0.5px;
    }
    .broker-header-row {
        gap: 0.75rem;
        margin-bottom: 1.25rem;
        padding-bottom: 1rem;
    }
    .broker-logo-box {
        width: 42px;
        height: 42px;
    }

    /* Trades View */
    .trade-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
        margin-bottom: 1rem;
    }
    .trade-summary-box {
        padding: 0.85rem;
    }
    .trade-summary-box .box-label {
        font-size: 0.72rem;
        margin-bottom: 0.2rem;
    }
    .trade-summary-box .box-value {
        font-size: 1.15rem;
    }
    .trade-summary-box .box-percent {
        font-size: 0.68rem;
    }

    .trade-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }
    .trade-filter-left {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .trade-filter-left select {
        width: 100% !important;
    }
    .btn-export {
        width: 100%;
        padding: 0.55rem;
    }
    .trade-filter-right {
        width: 100%;
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }
    .date-filter-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
    .date-filter-item input[type="date"] {
        width: 100% !important;
    }

    /* Table Container Touch Scroll */
    .table-container {
        border-radius: 8px;
        -webkit-overflow-scrolling: touch;
    }
    .modern-table th, .modern-table td {
        padding: 0.65rem 0.75rem;
        font-size: 0.78rem;
    }

    /* Settings Tab */
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Modals */
    .modal-content {
        width: calc(100% - 1.25rem);
        max-width: 100%;
        margin: 0.6rem;
        max-height: 92vh;
        border-radius: 12px;
    }
    .modal-header {
        padding: 1rem 1.15rem;
    }
    .modal-body {
        padding: 1.15rem;
    }
    .modal-body .flex.gap-2 {
        flex-wrap: wrap;
    }
    .modal-body .flex.gap-2 .input-group.flex-1 {
        min-width: 100%;
    }

    /* Auth Screen */
    .auth-box-modern {
        padding: 1.75rem 1.25rem;
        margin: 1rem;
        max-width: calc(100% - 2rem);
        border-radius: 14px;
    }

    /* iOS Safari zoom prevention on focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    select {
        font-size: 16px;
    }
}

/* ========================================================
   RESPONSIVE DESIGN (Extra Small Devices < 480px)
   ======================================================== */
@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem 0.5rem 2rem 0.5rem;
    }

    .stats-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .stat-card-modern {
        padding: 0.65rem 0.5rem;
        gap: 0.5rem;
    }
    .stat-icon-box {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
        border-radius: 6px;
    }
    .stat-details label {
        font-size: 0.65rem;
    }
    .stat-details .stat-number {
        font-size: 1.05rem;
    }

    /* Strategy Card Footer 2x2 grid */
    .strategy-card-footer {
        grid-template-columns: repeat(2, 1fr);
    }
    .st-footer-tab {
        border-bottom: 1px solid var(--border-color);
        padding: 0.65rem 0.25rem;
    }
    .st-footer-tab:nth-child(2) {
        border-right: none;
    }

    .countdown-digits {
        font-size: 0.85rem;
        letter-spacing: 0;
    }

    .trade-summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    .trade-summary-box {
        padding: 0.6rem 0.5rem;
    }
    .trade-summary-box .box-value {
        font-size: 1rem;
    }

    .trade-filter-right {
        flex-direction: column;
    }
    .date-filter-item {
        width: 100%;
    }
}
