/* =============================================================
   GemFinder Trading Terminal — Dark Terminal Theme
   Padre.gg-Inspired Single-Token Focus Layout
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0e17;
    --bg-card: rgba(15, 20, 35, 0.8);
    --bg-card-hover: rgba(20, 28, 50, 0.9);
    --border-glow: rgba(0, 200, 255, 0.15);
    --border-glow-strong: rgba(0, 200, 255, 0.35);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-dim: #64748b;
    --green: #22c55e;
    --green-glow: rgba(34, 197, 94, 0.4);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.4);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.3);
    --yellow: #eab308;
    --purple: #a855f7;
    --orange: #f97316;
    --pink: #ec4899;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* CRT scanline overlay */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 3px
    );
}

/* ==================================================================
   HEADER
   ================================================================== */
.header {
    background: linear-gradient(180deg, rgba(15, 20, 35, 0.95) 0%, rgba(10, 14, 23, 0.98) 100%);
    border-bottom: 1px solid var(--border-glow);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.online {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
    animation: pulse-glow 2s ease-in-out infinite;
}
.status-dot.offline {
    background: var(--red);
    box-shadow: 0 0 8px var(--red-glow);
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-stats {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.stat-chip {
    font-size: 11px;
    color: var(--text-secondary);
}
.stat-chip .value {
    font-weight: 600;
    color: var(--text-primary);
}
.stat-chip .value.positive { color: var(--green); text-shadow: 0 0 8px var(--green-glow); }
.stat-chip .value.negative { color: var(--red); text-shadow: 0 0 8px var(--red-glow); }

.mode-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
}
.mode-badge.paper {
    background: rgba(234, 179, 8, 0.15);
    color: var(--yellow);
    border: 1px solid rgba(234, 179, 8, 0.3);
}
.mode-badge.live {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-btn {
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 4px;
    border: 1px solid var(--border-glow);
    background: rgba(6, 182, 212, 0.1);
    color: var(--cyan);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}
.header-btn:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--cyan);
}

/* ==================================================================
   TRENDING TICKER
   ================================================================== */
.ticker-strip {
    background: rgba(10, 14, 23, 0.95);
    border-bottom: 1px solid var(--border-glow);
    overflow: hidden;
    white-space: nowrap;
    height: 28px;
    line-height: 28px;
    font-size: 11px;
}
.ticker-track {
    display: inline-block;
    animation: ticker-scroll 40s linear infinite;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.ticker-strip:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}
.ticker-item {
    display: inline-block;
    padding: 0 20px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    border-right: 1px solid rgba(255,255,255,0.05);
}
.ticker-item:hover { color: var(--cyan); }

/* Token icon — shared base */
.token-icon {
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    flex-shrink: 0;
}
.ticker-icon { width: 16px; height: 16px; margin-right: 4px; }
.alert-icon { width: 20px; height: 20px; margin-right: 4px; }
.chart-icon { width: 18px; height: 18px; margin-right: 4px; }

.ticker-loading {
    color: var(--text-dim);
    font-style: italic;
}

/* ==================================================================
   PNL STRIP (mobile only)
   ================================================================== */
.pnl-strip {
    display: none;
}

/* ==================================================================
   MAIN LAYOUT
   ================================================================== */
.dashboard {
    padding: 12px 16px 48px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 1800px;
    margin: 0 auto;
}

/* ---- Glass Card ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    padding: 14px 16px;
    backdrop-filter: blur(12px);
}

.card-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* ==================================================================
   ALERT CARDS RIBBON
   ================================================================== */
.alerts-ribbon {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glow) transparent;
}

.alert-card {
    background: rgba(10, 14, 23, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.15);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 180px;
    max-width: 220px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.alert-card:hover {
    border-color: var(--cyan);
    background: rgba(6, 182, 212, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.1);
}
.alert-card.has-position {
    border-color: var(--green);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.1);
}
.alert-card.has-position::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green-glow);
}
.alert-card.active-alert {
    border-color: var(--cyan);
    background: rgba(6, 182, 212, 0.12);
    box-shadow: 0 0 12px var(--cyan-glow);
}

.ac-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.ac-symbol {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.ac-score {
    font-size: 20px;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: 0 0 8px var(--cyan-glow);
    margin: 2px 0;
}
.ac-row {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ac-label {
    color: var(--text-dim);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 22px;
}
.ac-divider {
    color: rgba(255, 255, 255, 0.15);
    margin: 0 1px;
}
.ac-alert-row {
    font-size: 9px;
    color: var(--text-dim);
    font-weight: 500;
    margin-top: 2px;
}
.ac-time {
    font-size: 8px;
    color: var(--cyan);
    text-align: center;
    margin-top: 2px;
}

/* Social icons on alert cards */
.ac-socials {
    display: flex;
    gap: 5px;
    margin-left: auto;
    padding-left: 6px;
    align-items: center;
}
.social-icon {
    color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
    transition: color 0.2s, filter 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
}
.social-icon:hover {
    color: #fff;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}
.social-icon svg { display: block; }

/* ==================================================================
   MAIN PANEL — CHART GRID + SIDE PANEL
   ================================================================== */
.main-panel {
    /* No card styling — acts as layout container */
}

/* Main content: chart grid (full width, side panel removed) */
.main-content {
    min-height: 400px;
}
.side-panel { display: none; }

/* Chart Grid (multiple chart cards) */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(580px, 1fr));
    gap: 10px;
}
.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    grid-column: 1 / -1;
}

/* ---- Chart Card ---- */
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.chart-card:hover {
    border-color: rgba(6, 182, 212, 0.25);
}
.chart-card.active-chart {
    border-color: var(--cyan);
    box-shadow: 0 0 12px var(--cyan-glow);
}

/* Card Header */
.cc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-glow);
    background: rgba(10, 14, 23, 0.6);
}
.cc-symbol {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}
.cc-pos {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.cc-socials {
    display: flex;
    gap: 5px;
    align-items: center;
}
.cc-spacer { flex: 1; }
.cc-tf {
    font-family: inherit;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-glow);
    background: rgba(10, 14, 23, 0.8);
    color: var(--text-secondary);
    cursor: pointer;
}
.cc-tf:hover { border-color: var(--cyan); color: var(--cyan); }
.cc-close {
    font-size: 16px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}
.cc-close:hover { background: rgba(239, 68, 68, 0.15); color: var(--red); }

/* Card Body: chart left + controls right */
.cc-body {
    display: flex;
    flex: 1;
    min-height: 440px;
}
.cc-chart-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}
.cc-chart-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Inline Trade Controls (right side of each card) */
.cc-controls {
    width: 170px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-left: 1px solid var(--border-glow);
    background: rgba(10, 14, 23, 0.4);
}
.cc-toggle {
    display: flex;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--border-glow);
}
.cc-toggle .bst-btn {
    flex: 1;
    padding: 6px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    transition: all 0.2s;
}
.cc-toggle .bst-btn:first-child {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border-radius: 5px 0 0 5px;
}
.cc-toggle .bst-btn:first-child.active { background: var(--green); color: #000; }
.cc-toggle .bst-btn:last-child {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border-radius: 0 5px 5px 0;
}
.cc-toggle .bst-btn:last-child.active { background: var(--red); color: #fff; }

.cc-amounts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}
.cc-amt-btn {
    padding: 6px 4px;
    border-radius: 5px;
    border: 1px solid var(--border-glow);
    background: rgba(15, 20, 35, 0.8);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.cc-amt-btn:hover { border-color: var(--cyan); }
.cc-amt-btn.selected {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--cyan);
    color: var(--cyan);
}

.cc-exec-btn {
    width: 100%;
    padding: 10px 6px;
    border-radius: 6px;
    border: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    margin-top: auto;
}
.cc-exec-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cc-exec-btn.buy-exec { background: var(--green); color: #000; }
.cc-exec-btn.buy-exec:not(:disabled):hover { box-shadow: 0 0 12px var(--green-glow); }
.cc-exec-btn.sell-exec { background: var(--red); color: #fff; }
.cc-exec-btn.sell-exec:not(:disabled):hover { box-shadow: 0 0 12px var(--red-glow); }

/* Inline Card Metrics (below buy/sell) */
.cc-metrics {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-glow);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.ccm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    padding: 1px 0;
}
.ccm-label {
    color: var(--text-dim);
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ccm-val {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 10px;
}
.ccm-val.positive { color: var(--green); }
.ccm-val.negative { color: var(--red); }
.ccm-val.neutral-color { color: var(--yellow); }
.ccm-divider {
    height: 1px;
    background: var(--border-glow);
    margin: 2px 0;
}
.ccm-pcs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}
.ccm-pc {
    text-align: center;
    padding: 2px;
    background: rgba(15, 20, 35, 0.6);
    border-radius: 3px;
}
.ccm-pc-label {
    display: block;
    font-size: 7px;
    color: var(--text-dim);
    text-transform: uppercase;
}
.ccm-pc-val {
    font-weight: 700;
    font-size: 9px;
    color: var(--text-secondary);
}
.ccm-pc-val.positive { color: var(--green); }
.ccm-pc-val.negative { color: var(--red); }

/* Side Panel Token Info */
.sp-token-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.sp-symbol {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.sp-socials {
    display: flex;
    gap: 6px;
    align-items: center;
}
.sp-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}
.sp-stat {
    font-size: 11px;
    color: var(--text-secondary);
}
.sp-stat-label {
    color: var(--text-dim);
    font-size: 9px;
    text-transform: uppercase;
    margin-right: 3px;
}

.ca-copy-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    font-family: inherit;
}
.ca-copy-btn:hover { background: rgba(255,255,255,0.15); color: var(--cyan); border-color: var(--cyan); }
.ca-copy-btn.copied { background: var(--green); color: #000; border-color: var(--green); }

/* Generic close button (modals) */
.close-btn {
    font-size: 16px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}
.close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

/* ==================================================================
   RIGHT SIDE PANEL (padre.gg inspired)
   ================================================================== */
.side-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: 600px;
}

/* Position Status */
.sp-position {
    min-height: 0;
}
.pos-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.pos-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 1px;
}
.pos-badge.OPEN { background: rgba(6, 182, 212, 0.15); color: var(--cyan); }
.pos-badge.PARTIAL { background: rgba(168, 85, 247, 0.15); color: var(--purple); }
.pos-badge.MOONBAG { background: rgba(234, 179, 8, 0.15); color: var(--yellow); }
.pos-badge.paper { background: rgba(156, 163, 175, 0.2); color: #9ca3af; font-style: italic; }
.pos-pnl {
    font-size: 14px;
    font-weight: 700;
}
.pos-pnl.positive { color: var(--green); text-shadow: 0 0 8px var(--green-glow); }
.pos-pnl.negative { color: var(--red); text-shadow: 0 0 8px var(--red-glow); }
.pos-pnl.neutral { color: var(--text-secondary); }
.pos-detail {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* (Buy/Sell toggle + amounts + execute are now per-chart-card: .cc-toggle, .cc-amounts, .cc-exec-btn) */

/* Price Change Chips */
.sp-price-changes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.pc-chip {
    text-align: center;
    padding: 4px;
    background: rgba(15, 20, 35, 0.8);
    border-radius: 4px;
    font-size: 10px;
}
.pc-label {
    display: block;
    font-size: 8px;
    color: var(--text-dim);
    text-transform: uppercase;
}
.pc-val {
    font-weight: 700;
    font-size: 11px;
}

/* Security Grid (padre.gg 2-column grid) */
.sp-section-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
}
.sp-security {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.sec-item {
    background: rgba(15, 20, 35, 0.6);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.sec-val {
    display: block;
    font-size: 14px;
    font-weight: 700;
}
.sec-val.positive { color: var(--green); }
.sec-val.negative { color: var(--red); }
.sec-val.neutral { color: var(--yellow); }
.sec-label {
    font-size: 8px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    display: block;
}

/* Trade Memory (side panel) */
.sp-memory {
    border-top: 1px solid var(--border-glow);
    padding-top: 8px;
}
.mem-wr-value {
    font-size: 14px;
    font-weight: 700;
}
.mem-wr-sample {
    font-size: 10px;
    color: var(--text-dim);
    margin-left: 4px;
}

/* Alert History (side panel) */
.sp-alert-history {
    border-top: 1px solid var(--border-glow);
    padding-top: 8px;
}
.alert-hist-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 10px;
    color: var(--text-secondary);
}
.alert-hist-row span:first-child {
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 9px;
}

/* ==================================================================
   BOTTOM ROW: POSITIONS + TRADES + ALERT FEED
   ================================================================== */
.bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.bottom-card {
    min-height: 0;
}

/* ---- Trade Table ---- */
.trade-table-container {
    overflow-y: auto;
    max-height: 240px;
}

.trade-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.trade-table th {
    text-align: left;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-glow);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-card);
}
.trade-table td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(100, 116, 139, 0.06);
    white-space: nowrap;
}
.trade-table tr.win { background: rgba(34, 197, 94, 0.04); }
.trade-table tr.loss { background: rgba(239, 68, 68, 0.04); }
.trade-table tr:hover { background: rgba(6, 182, 212, 0.06); }

/* ---- PnL Colors ---- */
.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral { color: var(--text-secondary); }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 11px;
}

/* ---- Open Positions Panel ---- */
.positions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}
.pos-card {
    background: rgba(15, 20, 35, 0.6);
    border: 1px solid rgba(100, 116, 139, 0.1);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.pos-card:hover {
    background: rgba(20, 28, 50, 0.8);
    border-color: var(--border-glow);
}
.pos-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.pos-card-sym {
    font-size: 12px;
    font-weight: 700;
    color: var(--cyan);
}
.pos-card-pnl {
    margin-left: auto;
    font-size: 13px;
    font-weight: 700;
}
.pos-card-mid {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 10px;
    margin-bottom: 3px;
}
.pos-card-sol { font-weight: 600; }
.pos-card-peak { color: var(--text-dim); }
.pos-card-hold { color: var(--text-dim); margin-left: auto; }
.pos-card-bot {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-dim);
}
.pos-card-count {
    font-size: 9px;
    font-weight: 600;
    color: var(--yellow);
    margin-left: 4px;
}

/* ---- Alert Feed Panel ---- */
.alert-feed {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}
.af-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 11px;
}
.af-item:hover {
    background: rgba(6, 182, 212, 0.06);
}
.af-time {
    font-size: 9px;
    color: var(--text-dim);
    min-width: 24px;
}
.af-sym {
    font-weight: 700;
    color: var(--text-primary);
    min-width: 60px;
}
.af-tier {
    font-size: 8px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
}
.af-tier.hc {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}
.af-tier.sp {
    background: rgba(234, 179, 8, 0.15);
    color: var(--yellow);
}
.af-score {
    font-size: 10px;
    color: var(--text-secondary);
}
.af-mc {
    font-size: 10px;
    color: var(--text-dim);
    margin-left: auto;
}
.af-pos-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    flex-shrink: 0;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.5); }

/* (Buzz feed removed — replaced by Open Positions + Alert Feed panels) */

/* ==================================================================
   CONTRACT SEARCH
   ================================================================== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 4px;
}
.contract-input {
    font-family: inherit;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-glow);
    background: rgba(15, 20, 35, 0.9);
    color: var(--text-primary);
    width: 200px;
    outline: none;
    transition: border-color 0.2s;
}
.contract-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 8px var(--cyan-glow);
}
.contract-input::placeholder {
    color: var(--text-dim);
    font-size: 9px;
}
.search-btn {
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-glow);
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}
.search-btn:hover {
    background: rgba(6, 182, 212, 0.3);
    border-color: var(--cyan);
}

/* ==================================================================
   TELEGRAM
   ================================================================== */
.tg-btn {
    background: rgba(0, 136, 204, 0.15) !important;
    border-color: rgba(0, 136, 204, 0.3) !important;
    color: #0088cc !important;
}
.tg-btn:hover {
    background: rgba(0, 136, 204, 0.3) !important;
    border-color: #0088cc !important;
}

/* ==================================================================
   WALLET & AUTH
   ================================================================== */
.wallet-btn {
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 4px;
    border: 1px solid rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.12);
    color: var(--green);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}
.wallet-btn:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: var(--green);
    box-shadow: 0 0 12px var(--green-glow);
}
.wallet-btn.connected {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--cyan);
}
.wallet-btn.connected:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--red);
}
.wallet-addr {
    font-size: 10px;
    font-weight: 500;
    color: var(--cyan);
    letter-spacing: 0.5px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}
.owner-badge {
    font-size: 8px;
    font-weight: 700;
    color: #000;
    background: var(--yellow);
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 1px;
    margin-left: 4px;
    vertical-align: middle;
}
.settings-btn {
    font-size: 16px;
    line-height: 1;
    padding: 2px 8px;
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.3);
    color: var(--purple);
}
.settings-btn:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--purple);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

/* ==================================================================
   SETTINGS MODAL
   ================================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: linear-gradient(135deg, rgba(15, 20, 35, 0.98), rgba(20, 28, 50, 0.95));
    border: 1px solid var(--border-glow-strong);
    border-radius: 12px;
    width: 420px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px var(--cyan-glow);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glow);
}
.modal-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--cyan);
}
.modal-body {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.setting-group { display: flex; flex-direction: column; gap: 4px; }
.setting-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.setting-input {
    font-family: inherit;
    font-size: 11px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-glow);
    background: rgba(10, 14, 23, 0.9);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.setting-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 8px var(--cyan-glow);
}
.setting-input::placeholder { color: var(--text-dim); font-size: 10px; }
.setting-hint { font-size: 9px; color: var(--text-dim); line-height: 1.3; }
.modal-save-btn {
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid var(--green);
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s;
    text-transform: uppercase;
    margin-top: 4px;
}
.modal-save-btn:hover {
    background: rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 12px var(--green-glow);
}

/* ==================================================================
   BUTTON STATES
   ================================================================== */
.btn-executing {
    opacity: 0.6;
    animation: pulse-exec 0.8s ease-in-out infinite;
}
@keyframes pulse-exec {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}
.btn-success {
    background: var(--green) !important;
    color: #fff !important;
    border-color: var(--green) !important;
}
.btn-fail {
    background: var(--red) !important;
    color: #fff !important;
    border-color: var(--red) !important;
}

/* ==================================================================
   TOAST NOTIFICATIONS
   ================================================================== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    backdrop-filter: blur(12px);
    pointer-events: auto;
    animation: toast-in 0.3s ease forwards;
    max-width: 320px;
    word-break: break-word;
}
.toast.success { background: rgba(34, 197, 94, 0.2); border: 1px solid rgba(34, 197, 94, 0.4); color: var(--green); }
.toast.error { background: rgba(239, 68, 68, 0.2); border: 1px solid rgba(239, 68, 68, 0.4); color: var(--red); }
.toast.info { background: rgba(6, 182, 212, 0.2); border: 1px solid rgba(6, 182, 212, 0.4); color: var(--cyan); }
.toast.out { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ==================================================================
   BOTTOM NAV (mobile only — hidden on desktop)
   ================================================================== */
.bottom-nav {
    display: none;
}

/* ==================================================================
   TABLET (< 1024px)
   ================================================================== */
@media (max-width: 1024px) {
    .bottom-row { grid-template-columns: 1fr 1fr; }
    .chart-grid { grid-template-columns: 1fr; }
    .header { padding: 8px 12px; }
    .dashboard { padding: 8px 12px; }
    .contract-input { width: 140px; }
}

/* ==================================================================
   MOBILE (< 768px) — Stacked layout + bottom nav
   ================================================================== */
@media (max-width: 768px) {
    /* ---- Header: slim ---- */
    .header {
        padding: 6px 10px;
        gap: 6px;
        flex-wrap: wrap;
    }
    .header-stats { display: none; }
    .header-title { font-size: 11px; letter-spacing: 0.5px; }
    .header-left { gap: 8px; flex-wrap: wrap; }

    .tg-btn { display: none; }
    .header-btn:not(.wallet-btn):not(.settings-btn) { display: none; }

    .search-bar {
        order: 10;
        width: 100%;
        display: flex;
    }
    .contract-input {
        flex: 1;
        width: auto;
        font-size: 12px;
        padding: 8px 12px;
    }
    .search-btn { padding: 8px 14px; font-size: 11px; }
    .header-actions { flex-wrap: nowrap; gap: 6px; }
    .wallet-btn { padding: 6px 12px; font-size: 10px; }
    .wallet-addr { max-width: 60px; font-size: 9px; }
    .settings-btn { width: 34px; height: 34px; font-size: 17px; }

    /* ---- Ticker: compact ---- */
    .ticker-strip { height: 24px; line-height: 24px; font-size: 10px; }

    /* ---- Alert ribbon: swipe cards ---- */
    .alerts-ribbon {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 0 4px 10px;
        gap: 10px;
        scrollbar-width: none;
    }
    .alerts-ribbon::-webkit-scrollbar { display: none; }
    .alert-card {
        min-width: 75vw;
        max-width: 80vw;
        padding: 14px 16px;
        scroll-snap-align: center;
        border-radius: 10px;
        background: rgba(10, 14, 23, 0.75);
    }
    .ac-symbol { font-size: 16px; }
    .ac-score { font-size: 24px; }
    .ac-row { font-size: 13px; gap: 6px; }
    .ac-label { font-size: 10px; }
    .ac-time { font-size: 9px; }
    .ac-socials { gap: 8px; }
    .social-icon { padding: 4px; }
    .social-icon svg { width: 16px; height: 16px; }

    /* ---- Main panel: stacked ---- */
    .chart-grid { grid-template-columns: 1fr; }
    .chart-empty { min-height: 50vh; }

    /* ---- Chart card: stacked on mobile (chart full-width, controls below) ---- */
    .cc-body { flex-direction: column; min-height: auto; }
    .cc-chart-wrap { min-height: 60vh; }
    .cc-controls {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-glow);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        padding: 8px;
    }
    .cc-toggle { width: 120px; flex-shrink: 0; }
    .cc-amounts { display: flex; gap: 4px; flex-shrink: 0; }
    .cc-amt-btn { padding: 8px 12px; font-size: 11px; }
    .cc-exec-btn { padding: 10px 16px; font-size: 12px; width: auto; flex-shrink: 0; }
    .cc-metrics {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px 12px;
        border-top: none;
        margin-top: 0;
        padding-top: 0;
        width: 100%;
    }
    .ccm-row { gap: 4px; font-size: 10px; }
    .ccm-pcs { grid-template-columns: repeat(4, 1fr); width: 100%; }
    .ccm-divider { display: none; }
    .cc-symbol { font-size: 11px; }

    /* ---- Bottom row: stacked ---- */
    .bottom-row { grid-template-columns: 1fr; gap: 8px; }
    .card { padding: 10px 12px; }
    .positions-list { max-height: 220px; }
    .alert-feed { max-height: 200px; }
    .af-item { font-size: 12px; padding: 7px 10px; }
    .pos-card { padding: 10px 12px; }
    .trade-table-container { max-height: 250px; }
    .trade-table { font-size: 11px; }
    .trade-table th { font-size: 9px; padding: 6px 8px; }
    .trade-table td { padding: 8px 6px; }
    .dashboard { padding: 6px 4px 80px; gap: 8px; }

    /* ---- Settings modal: bottom sheet ---- */
    .modal { align-items: flex-end; }
    .modal-content {
        width: 100vw;
        max-width: 100vw;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
    }
    .modal-header { padding: 14px 16px; }
    .modal-body { padding: 14px 16px 24px; }
    .setting-input { font-size: 16px; padding: 14px 12px; }
    .modal-save-btn { width: 100%; padding: 16px; font-size: 14px; min-height: 52px; touch-action: manipulation; }

    /* ---- General mobile ---- */
    body::after { display: none; }

    .alert-card { background: rgba(10, 14, 23, 0.8); }

    .alerts-ribbon,
    .positions-list,
    .alert-feed,
    .trade-table-container,
    .modal-content,
    .side-panel {
        -webkit-overflow-scrolling: touch;
    }

    button, .alert-card, .header-btn, .wallet-btn,
    .settings-btn, .cc-tf, .modal-save-btn,
    .cc-amt-btn, .cc-exec-btn, .bst-btn {
        touch-action: manipulation;
    }

    /* ---- Button press feedback ---- */
    .cc-amt-btn:active, .cc-exec-btn:active { transform: scale(0.95); }
    .alert-card:active { transform: scale(0.97); }

    /* ---- PnL Strip: sticky below header ---- */
    .pnl-strip {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: sticky;
        top: 42px;
        z-index: 99;
        padding: 6px 12px;
        font-size: 11px;
        font-weight: 600;
        color: var(--text-secondary);
        background: rgba(10, 14, 23, 0.92);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-glow);
    }
    .pnl-strip .positive { color: var(--green); text-shadow: 0 0 6px var(--green-glow); }
    .pnl-strip .negative { color: var(--red); text-shadow: 0 0 6px var(--red-glow); }

    /* ---- Bottom Nav ---- */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(10, 14, 23, 0.95);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border-glow);
        padding: 4px 0;
        padding-bottom: max(4px, env(safe-area-inset-bottom));
    }
    .nav-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 6px 0;
        border: none;
        background: none;
        color: var(--text-dim);
        cursor: pointer;
        font-family: inherit;
        position: relative;
        touch-action: manipulation;
        transition: color 0.2s;
    }
    .nav-tab.active { color: var(--cyan); }
    .nav-icon { font-size: 18px; line-height: 1; }
    .nav-label {
        font-size: 9px;
        font-weight: 600;
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }
    .nav-badge {
        position: absolute;
        top: 2px;
        right: calc(50% - 16px);
        min-width: 14px;
        height: 14px;
        padding: 0 4px;
        border-radius: 7px;
        background: var(--cyan);
        color: #000;
        font-size: 8px;
        font-weight: 700;
        display: none;
        align-items: center;
        justify-content: center;
        line-height: 14px;
    }
    .nav-badge.visible { display: flex; }

    /* ---- Section visibility for tab switching ---- */
    .section-hidden { display: none !important; }
    .bottom-row { display: contents; }

    .dashboard { padding-bottom: 80px; }

    /* Toast centered on mobile */
    .toast-container {
        top: auto;
        bottom: 70px;
        right: 50%;
        transform: translateX(50%);
        align-items: center;
    }
    .toast { max-width: 90vw; text-align: center; }
    @keyframes toast-in {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
    @keyframes toast-out {
        from { opacity: 1; transform: translateY(0); }
        to { opacity: 0; transform: translateY(20px); }
    }

    /* ---- Copilot: hide desktop sidebar on mobile ---- */
    .copilot-panel {
        display: none !important;
    }
    .copilot-btn { display: none; }

    /* ---- Copilot: fullscreen section on mobile ---- */
    .copilot-section {
        position: fixed;
        top: 42px;
        left: 0;
        right: 0;
        bottom: 66px;
        bottom: calc(66px + env(safe-area-inset-bottom, 0px));
        z-index: 150;
        background: var(--bg-primary);
    }
    .copilot-section.section-hidden {
        display: none !important;
    }
    .copilot-fullscreen {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    .copilot-fullscreen .copilot-messages {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        overscroll-behavior: contain;
    }
    .copilot-fullscreen .copilot-input-wrap {
        flex-shrink: 0;
        padding: 10px 12px;
        border-top: 1px solid var(--border-glow);
        background: rgba(10, 14, 23, 0.98);
    }
    .copilot-fullscreen .copilot-input {
        font-size: 16px;
        padding: 12px 14px;
    }
    .copilot-fullscreen .copilot-send {
        width: 44px;
        height: 44px;
    }
}

/* ==================================================================
   1. P&L FLASH ANIMATION
   ================================================================== */
@keyframes pnl-flash-green {
    0% { background: transparent; }
    30% { background: rgba(34, 197, 94, 0.25); }
    100% { background: transparent; }
}
@keyframes pnl-flash-red {
    0% { background: transparent; }
    30% { background: rgba(239, 68, 68, 0.25); }
    100% { background: transparent; }
}
.pos-card.pnl-up { animation: pnl-flash-green 0.8s ease-out; }
.pos-card.pnl-down { animation: pnl-flash-red 0.8s ease-out; }

/* ==================================================================
   3. FULLSCREEN CHART MODE
   ================================================================== */
.cc-fullscreen-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.2s;
}
.cc-fullscreen-btn:hover { color: var(--cyan); }

.chart-card.fullscreen {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9998;
    margin: 0;
    border-radius: 0;
    max-width: 100vw;
    min-width: 100vw;
    width: 100vw;
    height: 100vh;
}
.chart-card.fullscreen .cc-body { height: calc(100vh - 40px); }
.chart-card.fullscreen .cc-chart-wrap { min-height: 70vh; height: 100%; }
.chart-card.fullscreen .cc-controls { max-height: 30vh; overflow-y: auto; }
.chart-card.fullscreen .cc-fullscreen-btn { color: var(--cyan); }

/* ==================================================================
   4. TOKEN QUICK-SWITCH TABS
   ================================================================== */
.chart-tabs {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(10, 14, 23, 0.6);
    border-bottom: 1px solid var(--border-glow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.chart-tabs::-webkit-scrollbar { display: none; }
.chart-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.chart-tab:hover { background: rgba(6, 182, 212, 0.08); color: var(--text-primary); }
.chart-tab.active-tab { background: rgba(6, 182, 212, 0.12); border-color: var(--cyan); color: var(--cyan); }
.chart-tab .tab-pnl { font-size: 9px; font-weight: 600; }
.chart-tab .tab-close {
    font-size: 12px;
    opacity: 0.4;
    margin-left: 2px;
    transition: opacity 0.15s;
}
.chart-tab .tab-close:hover { opacity: 1; color: var(--red); }

/* ==================================================================
   6. LOADING SKELETONS
   ================================================================== */
@keyframes skeleton-pulse {
    0% { opacity: 0.4; }
    50% { opacity: 0.8; }
    100% { opacity: 0.4; }
}
.skeleton {
    background: linear-gradient(90deg, rgba(30,40,60,0.5) 25%, rgba(50,65,90,0.5) 50%, rgba(30,40,60,0.5) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
}
.skeleton-text { height: 12px; margin: 4px 0; }
.skeleton-card {
    height: 120px;
    min-width: 180px;
    border-radius: 10px;
}
.skeleton-chart { height: 300px; border-radius: 8px; }
.skeleton-row { height: 32px; margin: 2px 0; }

/* ==================================================================
   7. EQUITY CURVE
   ================================================================== */
.equity-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 12px;
}
.equity-card .card-title { margin-bottom: 8px; }
.equity-canvas-wrap {
    width: 100%;
    height: 120px;
    position: relative;
}
.equity-canvas-wrap canvas {
    width: 100%;
    height: 100%;
}

/* ==================================================================
   8. ALERT CARD GLOW ON NEW ARRIVAL
   ================================================================== */
@keyframes alert-new-glow {
    0% { box-shadow: 0 0 8px rgba(6, 182, 212, 0.6), 0 0 20px rgba(6, 182, 212, 0.3); border-color: var(--cyan); }
    50% { box-shadow: 0 0 16px rgba(6, 182, 212, 0.8), 0 0 40px rgba(6, 182, 212, 0.4); border-color: var(--cyan); }
    100% { box-shadow: 0 0 8px rgba(6, 182, 212, 0.6), 0 0 20px rgba(6, 182, 212, 0.3); border-color: var(--cyan); }
}
.alert-card.new-alert {
    animation: alert-new-glow 1.5s ease-in-out 3;
}

/* ==================================================================
   10. CONFETTI / SUCCESS ANIMATION
   ================================================================== */
.confetti-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    top: -10px;
    animation: confetti-fall 1.5s ease-in forwards;
}
@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ==================================================================
   11. COPILOT CHAT PANEL
   ================================================================== */

/* ---- Desktop: right sidebar ---- */
.copilot-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: rgba(10, 14, 23, 0.97);
    border-left: 1px solid var(--border-glow);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.copilot-panel.open {
    right: 0;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.5);
}

.copilot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glow);
    flex-shrink: 0;
}
.copilot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.copilot-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.copilot-status {
    font-size: 9px;
    color: var(--text-dim);
}
.copilot-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}
.copilot-close:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

/* ---- Messages area ---- */
.copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(100,116,139,0.3) transparent;
}
.copilot-messages::-webkit-scrollbar { width: 4px; }
.copilot-messages::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.3); border-radius: 4px; }

/* ---- Welcome message ---- */
.copilot-welcome {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: rgba(6, 182, 212, 0.06);
    border: 1px solid rgba(6, 182, 212, 0.12);
    border-radius: 10px;
    margin-bottom: 8px;
}
.copilot-welcome-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.copilot-welcome-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- Chat bubbles ---- */
.copilot-bubble {
    max-width: 88%;
    animation: bubble-in 0.2s ease-out;
}
@keyframes bubble-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.copilot-bubble.user {
    align-self: flex-end;
}
.copilot-bubble.assistant {
    align-self: flex-start;
}

.copilot-bubble-text {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.copilot-bubble.user .copilot-bubble-text {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(6, 182, 212, 0.25);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}
.copilot-bubble.assistant .copilot-bubble-text {
    background: rgba(15, 20, 35, 0.8);
    border: 1px solid var(--border-glow);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.copilot-bubble-time {
    font-size: 9px;
    color: var(--text-dim);
    margin-top: 4px;
    padding: 0 4px;
}
.copilot-bubble.user .copilot-bubble-time { text-align: right; }

/* ---- Typing indicator ---- */
.copilot-typing-dots {
    display: flex;
    gap: 5px;
    padding: 10px 14px;
    background: rgba(15, 20, 35, 0.8);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}
.copilot-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
    animation: typing-bounce 1.4s infinite ease-in-out;
}
.copilot-typing-dots span:nth-child(1) { animation-delay: 0s; }
.copilot-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.copilot-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---- Input area ---- */
.copilot-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border-glow);
    background: rgba(10, 14, 23, 0.95);
    flex-shrink: 0;
}
.copilot-input {
    flex: 1;
    background: rgba(15, 20, 35, 0.8);
    border: 1px solid var(--border-glow);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.copilot-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.15);
}
.copilot-input::placeholder {
    color: var(--text-dim);
}
.copilot-input:disabled {
    opacity: 0.5;
}
.copilot-send {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
}
.copilot-send:hover { transform: scale(1.05); }
.copilot-send:active { transform: scale(0.95); }
.copilot-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Desktop AI button in header ---- */
.copilot-btn {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--cyan);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
}
.copilot-btn:hover {
    border-color: var(--cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

/* ---- Copilot section: hidden on desktop (only visible on mobile via tab) ---- */
@media (min-width: 769px) {
    .copilot-section { display: none !important; }
}

/* ==================================================================
   SMALL PHONE (< 480px)
   ================================================================== */
@media (max-width: 480px) {
    .header { padding: 6px 8px; }
    .header-left { gap: 6px; }
    .header-title { font-size: 10px; letter-spacing: 0; }
    .wallet-btn { padding: 5px 8px; font-size: 9px; }
    .settings-btn { width: 30px; height: 30px; font-size: 15px; }
    .alert-card { min-width: 70vw; max-width: 78vw; padding: 12px 14px; }
    .ac-symbol { font-size: 14px; }
    .ac-score { font-size: 20px; }
    .ac-row { font-size: 12px; }
    .chart-empty { min-height: 45vh; }
    .cc-chart-wrap { min-height: 55vh; }
    .modal-content { max-height: 95vh; }
    .chart-tabs { padding: 3px 6px; }
    .chart-tab { padding: 3px 8px; font-size: 9px; }
    .equity-canvas-wrap { height: 80px; }
    .copilot-bubble-text { font-size: 13px; }
    .copilot-welcome-text { font-size: 13px; }
}
