:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #22c55e;
    --danger: #ef4444;
    --bg-dark: #0f1120;
    --surface: #ffffff;
    --sidebar-bg: #14162a;
    --text-dark: #1e1e2d;
    --text-muted: #8a8fa3;
    --border: #eceefb;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(30, 30, 60, 0.08);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f4f5fb;
    color: var(--text-dark);
    overflow-x: hidden; /* safety net: stops any inner element that still
        forces extra width from creating page-wide horizontal scroll */
}

/* ---------------- LOGIN PAGE (split screen) ---------------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: #f4f5fb;
}

/* -------- Left: crypto trading visual panel -------- */
.login-visual {
    flex: 1.1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 56px;
    color: #fff;
    background: radial-gradient(circle at 15% 15%, #1b2454 0%, #0b0f1e 55%, #05070f 100%);
}

.login-visual::before,
.login-visual::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.45;
    animation: float 9s ease-in-out infinite;
}
.login-visual::before {
    width: 340px; height: 340px;
    background: #6366f1;
    top: -80px; left: -80px;
}
.login-visual::after {
    width: 380px; height: 380px;
    background: #22d3ee;
    bottom: -120px; right: -100px;
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

.visual-content { position: relative; z-index: 2; }

.visual-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: #67e8f9;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 22px;
}
.visual-tag .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.visual-content h1 {
    font-size: 32px;
    line-height: 1.25;
    font-weight: 700;
    margin-bottom: 14px;
    max-width: 420px;
}
.visual-content h1 span {
    background: linear-gradient(90deg, #818cf8, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.visual-content > p {
    font-size: 14px;
    color: #9ca3d4;
    max-width: 380px;
    line-height: 1.7;
    margin-bottom: 34px;
}

/* Chart card */
.chart-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px 22px;
    backdrop-filter: blur(10px);
    max-width: 420px;
    margin-bottom: 26px;
}
.chart-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.chart-pair { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.chart-pair .coin-icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f7931a, #ffb454);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #1a1200;
}
.chart-price { font-size: 15px; font-weight: 700; }
.chart-change {
    font-size: 11.5px;
    font-weight: 700;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
    padding: 2px 8px;
    border-radius: 6px;
}

.candles {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 90px;
}
.candle {
    flex: 1;
    border-radius: 2px;
    animation: candleGrow 1s ease forwards;
    transform-origin: bottom;
}
.candle.up { background: #22c55e; }
.candle.down { background: #ef4444; }
@keyframes candleGrow {
    from { transform: scaleY(0); opacity: 0; }
    to { transform: scaleY(1); opacity: 1; }
}

/* Ticker strip */
.ticker-strip {
    overflow: hidden;
    max-width: 420px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 18px;
}
.ticker-track {
    display: flex;
    gap: 26px;
    width: max-content;
    animation: tickerScroll 16s linear infinite;
}
.ticker-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    white-space: nowrap;
    color: #c7cbe8;
}
.ticker-item b { color: #fff; }
.ticker-item.pos { color: #4ade80; }
.ticker-item.neg { color: #f87171; }
@keyframes tickerScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Floating coin badges */
.floating-coin {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 10px 26px rgba(0,0,0,0.35);
    animation: coinFloat 5s ease-in-out infinite;
    z-index: 1;
}
.coin-1 { width: 46px; height: 46px; font-size: 18px; top: 14%; right: 12%; background: linear-gradient(135deg, #f7931a, #ffb454); animation-delay: 0s; }
.coin-2 { width: 34px; height: 34px; font-size: 13px; top: 62%; right: 22%; background: linear-gradient(135deg, #627eea, #8fa3ff); animation-delay: -1.5s; }
.coin-3 { width: 28px; height: 28px; font-size: 11px; top: 40%; right: 4%; background: linear-gradient(135deg, #22d3ee, #67e8f9); color: #06222a; animation-delay: -3s; }

@keyframes coinFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}

/* -------- Right: login form side -------- */
.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    animation: cardIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.login-logo .brand-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), #22d3ee);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white;
}
.login-logo .brand-icon svg { width: 22px; height: 22px; }

.login-logo span {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
}
.login-logo span b { color: var(--primary); }

.login-card h2 {
    text-align: center;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group svg {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    color: var(--text-muted);
    transition: var(--transition);
}

.form-group input {
    width: 100%;
    padding: 14px 14px 14px 42px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14.5px;
    background: #fafbff;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.form-group:focus-within svg {
    color: var(--primary);
}

.toggle-pass {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    left: auto !important;
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    font-size: 13px;
    color: var(--text-muted);
}

.form-options label {
    display: flex; align-items: center; gap: 6px;
    cursor: pointer;
}

.btn-login {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(99, 102, 241, 0.45); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.spinner {
    width: 16px; height: 16px;
    border: 2.5px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.btn-login.loading .spinner { display: inline-block; }
.btn-login.loading .btn-text { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.alert-box {
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 18px;
    display: none;
    align-items: center;
    gap: 8px;
}
.alert-box.show { display: flex; animation: shake 0.4s; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.login-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.demo-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 14px;
    background: #f4f5fb;
    padding: 8px 10px;
    border-radius: 8px;
}

/* ---------------- DASHBOARD LAYOUT ---------------- */
.app-wrapper { display: flex; min-height: 100vh; max-width: 100vw; }

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.bot-status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 18px;
    padding: 11px 13px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}
.bot-status-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #6b7094;
    flex-shrink: 0;
}
.bot-status-dot.live {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse-dot 1.6s ease-in-out infinite;
}
.bot-status-dot.warn {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}
.bot-status-title { font-size: 12.5px; font-weight: 700; color: #fff; }
.bot-status-sub { font-size: 10.5px; color: #6b7094; margin-top: 1px; }
.bot-status-box.live { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.25); }
.bot-status-box.warn { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.25); }

/* ---------------- PROFIT REPORT ---------------- */
.pnl-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.pnl-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
}
.pnl-card .pnl-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.pnl-card .pnl-value { font-size: 22px; font-weight: 700; }
.pnl-card .pnl-value.positive { color: var(--success); }
.pnl-card .pnl-value.negative { color: var(--danger); }
.pnl-card .pnl-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.data-table-wrap {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 720px;
}
.data-table th {
    text-align: left;
    padding: 14px 18px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbff; }

.pnl-cell.positive { color: var(--success); font-weight: 700; }
.pnl-cell.negative { color: var(--danger); font-weight: 700; }

.trade-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}
.trade-status-pill.open { background: #eef0ff; color: var(--primary); }
.trade-status-pill.closed { background: #f4f5fb; color: var(--text-muted); }

.report-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.report-filter-bar input[type="date"] {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 13px;
    font-family: inherit;
    background: #fafbff;
}

.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), #22d3ee);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-brand .brand-icon svg { width: 18px; height: 18px; color: #fff; }
.brand-text { font-size: 18px; font-weight: 700; }
.brand-text b { color: var(--primary-light); }

.sidebar-nav { padding: 20px 14px; flex: 1; overflow-y: auto; }

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7094;
    margin: 18px 10px 8px;
    font-weight: 600;
}
.nav-label:first-child { margin-top: 0; }

.sidebar-nav ul { list-style: none; }

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: #b3b6d1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item a svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:not(.disabled) a:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #fff;
}

.nav-item.active a {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.nav-item.disabled a { opacity: 0.45; cursor: not-allowed; }

.soon-badge {
    margin-left: auto;
    font-size: 9.5px;
    font-style: normal;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 6px;
}

/* Main content */
.main-content {
    margin-left: 250px;
    flex: 1;
    min-width: 0; /* .main-content is a flex item of the ROW-direction
        .app-wrapper, so it defaults to min-width:auto - meaning it
        refuses to shrink below its content's natural width and forces
        the whole page to overflow horizontally on mobile. Without this,
        every page needs its own local override to fix it. */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* ---------------- SHARED PAGE FOOTER (includes/footer.php) ---------------- */
.dash-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 28px;
    padding: 20px 24px;
    border-radius: var(--radius);
    background: var(--sidebar-bg);
    min-width: 0;
}
.dash-footer-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
}
.dash-footer-logo-img {
    display: block;
    height: 22px;
    width: auto;
    max-width: 100%;
    aspect-ratio: 178 / 32;
    object-fit: contain;
}
.dash-footer-copy {
    font-size: 11.5px;
    color: rgba(255,255,255,0.45);
}
.dash-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.dash-footer-links a {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.6) !important;
    text-decoration: none !important;
    transition: var(--transition);
}
.dash-footer-links a:hover { color: #fff !important; }
.dash-footer-dot {
    color: rgba(255,255,255,0.2);
    font-size: 12px;
    line-height: 1;
}
@media (max-width: 560px) {
    .dash-footer { flex-direction: column; align-items: flex-start; }
    .dash-footer-links { gap: 6px 10px; }
    .dash-footer-logo-img { height: 19px; }
}

.topbar {
    height: 68px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

#menuToggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dark);
}
#menuToggle svg { width: 22px; height: 22px; }

.page-title { font-size: 18px; font-weight: 700; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    background: #f4f5fb;
    border-radius: 30px;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: #f4f5fb;
    border-radius: 30px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}
.user-menu-trigger:hover { background: #eceefb; }
.user-menu-trigger .chevron {
    width: 14px; height: 14px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.user-menu-trigger.open .chevron { transform: rotate(180deg); }

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 190px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 16px 36px rgba(30, 30, 60, 0.16);
    padding: 6px;
    display: none;
    z-index: 60;
}
.user-menu-dropdown.show {
    display: block;
    animation: dropdownIn 0.16s ease;
}
@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}
.user-menu-item:hover { background: #f4f5fb; }
.user-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted); }
.user-menu-item.js-logout { color: var(--danger); }
.user-menu-item.js-logout svg { color: var(--danger); }
.user-menu-divider { height: 1px; background: var(--border); margin: 5px 6px; }

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #22d3ee);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.user-info { line-height: 1.25; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.btn-logout-top {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff1f1;
    color: var(--danger);
    border: 1px solid #ffd7d7;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-logout-top:hover { background: var(--danger); color: #fff; }
.btn-logout-top svg { width: 15px; height: 15px; }

.page-body { padding: 28px; flex: 1; animation: fadeUp 0.5s ease; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-banner {
    background: linear-gradient(120deg, var(--primary), #4338ca 60%, #22d3ee);
    color: #fff;
    border-radius: var(--radius);
    padding: 30px 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.welcome-banner h1 { font-size: 22px; margin-bottom: 6px; }
.welcome-banner p { font-size: 14px; opacity: 0.9; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(30,30,60,0.12); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: #eef0ff; color: var(--primary); }
.stat-icon.green { background: #e9fbf0; color: var(--success); }
.stat-icon.orange { background: #fff5e9; color: #f59e0b; }

.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12.5px; color: var(--text-muted); }

.panel-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}
.panel-card h3 { font-size: 15px; margin-bottom: 14px; }
.panel-card p { color: var(--text-muted); font-size: 13.5px; line-height: 1.7; }

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 90;
}

/* ---------------- LOGOUT PAGE ---------------- */
.logout-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    background: linear-gradient(135deg, #0f1120 0%, #1e2247 45%, #4338ca 100%);
    color: #fff;
}
.logout-spinner {
    width: 44px; height: 44px;
    border: 3.5px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.logout-wrapper p { font-size: 15px; opacity: 0.9; }

/* ---------------- SIDEBAR "Bot" BADGE ---------------- */
.new-badge {
    margin-left: auto;
    font-size: 9.5px;
    font-style: normal;
    font-weight: 700;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--primary), #22d3ee);
    color: #fff;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.03em;
}

/* ---------------- SETTINGS PAGES (shared) ---------------- */
.settings-header {
    margin-bottom: 22px;
}
.settings-header h2 {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 4px;
}
.settings-header p {
    font-size: 13.5px;
    color: var(--text-muted);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.settings-grid.two-col {
    grid-template-columns: repeat(2, 1fr);
}

.section-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: fadeUp 0.5s ease;
}

.section-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.section-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #22d3ee);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.section-icon svg { width: 19px; height: 19px; }

.section-card-title h3 { font-size: 14.5px; font-weight: 700; }
.section-card-title span { font-size: 12px; color: var(--text-muted); }

.section-card-body { padding: 22px; }

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-dark);
}

.field .field-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="time"],
.field select {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 13.5px;
    background: #fafbff;
    transition: var(--transition);
    outline: none;
    color: var(--text-dark);
    font-family: inherit;
}

.field input:focus,
.field select:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.field-prefix-wrap {
    position: relative;
}
.field-prefix-wrap .prefix {
    position: absolute;
    left: 13px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13.5px;
    pointer-events: none;
}
.field-prefix-wrap input {
    padding-left: 28px !important;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
}
.status-badge.connected {
    background: #e9fbf0;
    color: var(--success);
}
.status-badge.not-connected {
    background: #fef2f2;
    color: var(--danger);
}
.status-badge .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
}

/* Section action buttons */
.section-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
}
.btn svg { width: 15px; height: 15px; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 22px rgba(99, 102, 241, 0.4); }

.btn-outline {
    background: #fff;
    color: var(--text-dark);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

.btn .btn-spinner {
    width: 13px; height: 13px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.btn.loading .btn-spinner { display: inline-block; }
.btn.loading .btn-label { display: none; }

/* Toggle switch */
.toggle-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: #fafbff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
}
.toggle-switch-row .toggle-label { font-size: 13.5px; font-weight: 600; }
.toggle-switch-row .toggle-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.toggle-switch {
    position: relative;
    width: 46px; height: 26px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0; height: 0;
    position: absolute;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d3e6;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--success), #16a34a);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Save bar (sticky bottom on settings pages) */
.save-bar {
    position: sticky;
    bottom: 0;
    margin-top: 24px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 -10px 24px rgba(30,30,60,0.06);
    flex-wrap: wrap;
}
.save-bar .save-note {
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 7px;
}
.save-bar .save-note svg { width: 15px; height: 15px; color: var(--primary); flex-shrink: 0; }

/* Account settings page specific */
.account-summary-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}
.account-avatar-lg {
    width: 60px; height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #22d3ee);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
}
.account-summary-card h3 { font-size: 16px; margin-bottom: 3px; }
.account-summary-card .acc-email { font-size: 12.5px; color: var(--text-muted); }

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.info-row:last-child { border-bottom: none; }
.info-row .info-label { display: flex; align-items: center; gap: 9px; color: var(--text-muted); }
.info-row .info-label svg { width: 16px; height: 16px; }
.info-row .info-value { font-weight: 600; color: var(--text-dark); }

.alert-inline {
    padding: 11px 14px;
    border-radius: 9px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    align-items: center;
    gap: 8px;
}
.alert-inline.show { display: flex; animation: shake 0.4s; }

/* ---------------- LIVE CHART PAGE ---------------- */
.chart-page-card {
    background: #0b0f1e;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chart-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.chart-symbol-block {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chart-symbol-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f7931a, #ffb454);
    color: #1a1200;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.chart-symbol-text h3 { color: #fff; font-size: 15.5px; font-weight: 700; }
.chart-symbol-text span { color: #8a8fc0; font-size: 12px; }

.chart-price-block { display: flex; align-items: baseline; gap: 10px; }
.chart-price-block .price { color: #fff; font-size: 20px; font-weight: 700; }
.chart-price-block .change { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 7px; }
.chart-price-block .change.up { color: #22c55e; background: rgba(34,197,94,0.12); }
.chart-price-block .change.down { color: #ef4444; background: rgba(239,68,68,0.12); }

.tf-group {
    display: flex;
    gap: 6px;
    background: rgba(255,255,255,0.06);
    padding: 4px;
    border-radius: 10px;
}
.tf-btn {
    border: none;
    background: transparent;
    color: #9ca3d4;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 7px;
    cursor: pointer;
    transition: var(--transition);
}
.tf-btn:hover { color: #fff; }
.tf-btn.active {
    background: linear-gradient(135deg, var(--primary), #22d3ee);
    color: #fff;
}

.chart-head-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle-btn {
    background: rgba(255,255,255,0.06);
    border: none;
    color: #9ca3d4;
    width: 36px; height: 36px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.theme-toggle-btn:hover { color: #fff; }
.theme-toggle-btn svg { width: 17px; height: 17px; }
.theme-toggle-btn .icon-moon { display: none; }

.indicator-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ind-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    color: #9ca3d4;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}
.ind-chip:hover { color: #fff; }
.ind-chip.active {
    background: rgba(99,102,241,0.18);
    border-color: rgba(99,102,241,0.45);
    color: #fff;
}
.ind-chip .ind-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.live-dot-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #8a8fc0;
    font-weight: 600;
}
.live-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse-dot 1.6s ease-in-out infinite;
}

.chart-container {
    width: 100%;
    height: 480px;
    position: relative;
}
.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a8fc0;
    font-size: 13px;
    gap: 10px;
}
.chart-loading .spinner {
    width: 16px; height: 16px;
    border: 2.5px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@media (max-width: 900px) {
    .chart-container { height: 380px; }
    .chart-page-head { flex-direction: column; align-items: flex-start; }
}

/* Light theme variant for the chart card */
.chart-page-card.theme-light { background: #ffffff; }
.chart-page-card.theme-light .chart-page-head,
.chart-page-card.theme-light .indicator-group { border-bottom-color: var(--border); }
.chart-page-card.theme-light .chart-symbol-text h3 { color: var(--text-dark); }
.chart-page-card.theme-light .chart-symbol-text span,
.chart-page-card.theme-light .live-dot-row { color: var(--text-muted); }
.chart-page-card.theme-light .tf-group { background: #f4f5fb; }
.chart-page-card.theme-light .tf-btn { color: var(--text-muted); }
.chart-page-card.theme-light .tf-btn:hover { color: var(--text-dark); }
.chart-page-card.theme-light .chart-price-block .price { color: var(--text-dark); }
.chart-page-card.theme-light .chart-loading { color: var(--text-muted); }
.chart-page-card.theme-light .theme-toggle-btn { background: #f4f5fb; color: var(--text-muted); }
.chart-page-card.theme-light .theme-toggle-btn:hover { color: var(--text-dark); }
.chart-page-card.theme-light .theme-toggle-btn .icon-sun { display: none; }
.chart-page-card.theme-light .theme-toggle-btn .icon-moon { display: block; }
.chart-page-card.theme-light .ind-chip { background: #f4f5fb; color: var(--text-muted); }
.chart-page-card.theme-light .ind-chip:hover { color: var(--text-dark); }
.chart-page-card.theme-light .ind-chip.active { background: rgba(99,102,241,0.12); border-color: rgba(99,102,241,0.3); color: var(--text-dark); }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    #menuToggle { display: block; }
    .overlay.show { display: block; }
    .user-info { display: none; }

    .login-visual { display: none; }
    .login-form-side { flex: 1 1 100%; }

    .settings-grid.two-col { grid-template-columns: 1fr; }
    .field-grid { grid-template-columns: 1fr; }
    .section-card-head { flex-direction: column; align-items: flex-start; gap: 10px; }
    .save-bar { flex-direction: column; align-items: stretch; text-align: center; }
    .account-summary-card { flex-direction: column; text-align: center; }
}
