/* ══════════════════════════════════════════════════════════════════════════════
   Upstox Portfolio Agent — Premium Design System
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ──────────────────────────────────────────────────────────── */
:root {
    /* Base colors */
    --bg-primary: #0a0e27;
    --bg-secondary: #111638;
    --bg-tertiary: #161b42;
    --bg-card: rgba(17, 22, 56, 0.7);
    --bg-card-hover: rgba(26, 32, 72, 0.8);

    /* Accent colors */
    --accent-primary: #4f7cff;
    --accent-secondary: #7b61ff;
    --accent-gradient: linear-gradient(135deg, #4f7cff, #7b61ff);
    --accent-gradient-hover: linear-gradient(135deg, #6b93ff, #9179ff);

    /* Status colors */
    --profit: #00d68f;
    --profit-bg: rgba(0, 214, 143, 0.12);
    --loss: #ff3d71;
    --loss-bg: rgba(255, 61, 113, 0.12);
    --warning: #ffaa00;
    --warning-bg: rgba(255, 170, 0, 0.12);
    --neutral: #8f9bb3;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #8f9bb3;
    --text-dim: #4a5072;

    /* Glass effect */
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-border-hover: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.4);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Chart palette */
    --chart-1: #4f7cff;
    --chart-2: #7b61ff;
    --chart-3: #00d68f;
    --chart-4: #ff3d71;
    --chart-5: #ffaa00;
    --chart-6: #36b5d8;
    --chart-7: #ff6b9d;
    --chart-8: #c4b5fd;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;

    /* Subtle radial gradient spots */
    background-image:
        radial-gradient(ellipse 600px 400px at 10% 10%, rgba(79, 124, 255, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 90% 80%, rgba(123, 97, 255, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 400px 300px at 50% 50%, rgba(0, 214, 143, 0.03) 0%, transparent 70%);
}

/* ── Custom Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ── Typography ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

/* ── Keyframe Animations ────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 214, 143, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(0, 214, 143, 0);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(79, 124, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(79, 124, 255, 0.5), 0 0 60px rgba(123, 97, 255, 0.2);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(10px, -15px);
    }
    50% {
        transform: translate(-5px, -25px);
    }
    75% {
        transform: translate(-15px, -10px);
    }
}

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

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════════════════════════ */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    padding: var(--space-xl);
}

/* Animated background orbs */
.login-bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: rgba(79, 124, 255, 0.15);
    top: 10%;
    left: 15%;
    animation: float 20s ease-in-out infinite;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: rgba(123, 97, 255, 0.12);
    top: 60%;
    right: 10%;
    animation: float 25s ease-in-out infinite reverse;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: rgba(0, 214, 143, 0.08);
    bottom: 10%;
    left: 40%;
    animation: float 18s ease-in-out infinite 5s;
}

/* Login container */
.login-container {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 680px;
    width: 100%;
    animation: fadeInUp 0.8s ease-out;
}

.login-logo {
    margin-bottom: var(--space-xl);
}

.login-logo-icon {
    display: inline-flex;
    padding: 6px;
    border-radius: 18px;
    background: rgba(79, 124, 255, 0.1);
    border: 1px solid rgba(79, 124, 255, 0.2);
}

.login-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 0%, #4f7cff 50%, #7b61ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin-bottom: var(--space-sm);
}

.login-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: var(--space-2xl);
    letter-spacing: 0.02em;
}

/* Feature cards */
.login-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.feature-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out calc(var(--delay) * 0.12s) both;
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.feature-icon--signals {
    background: rgba(79, 124, 255, 0.15);
    color: var(--accent-primary);
}

.feature-icon--trading {
    background: rgba(0, 214, 143, 0.15);
    color: var(--profit);
}

.feature-icon--risk {
    background: rgba(123, 97, 255, 0.15);
    color: var(--accent-secondary);
}

.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.feature-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Login button */
.login-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 40px;
    border: none;
    border-radius: var(--radius-xl);
    background: var(--accent-gradient);
    color: #fff;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: var(--space-lg);
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

.login-btn:hover {
    transform: scale(1.04);
    animation: glow 2s ease-in-out infinite;
}

.login-btn:active {
    transform: scale(0.98);
}

.login-btn-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

.login-btn-content {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    z-index: 1;
}

.login-footer {
    font-size: 0.78rem;
    color: var(--text-dim);
    animation: fadeIn 0.6s ease-out 0.6s both;
}

/* ══════════════════════════════════════════════════════════════════════════════
   NAVIGATION BAR
   ══════════════════════════════════════════════════════════════════════════════ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    height: 64px;
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 1px 24px rgba(0, 0, 0, 0.25);
}

.nav-left,
.nav-center,
.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.nav-left { flex: 1; }
.nav-center { flex: 0 0 auto; }
.nav-right { flex: 1; justify-content: flex-end; }

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-logo svg {
    flex-shrink: 0;
}

.nav-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Market status */
.market-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 14px;
    border-radius: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    font-size: 0.82rem;
    font-weight: 500;
}

.market-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--loss);
    flex-shrink: 0;
}

.market-dot.open {
    background: var(--profit);
    animation: pulse 2s ease-in-out infinite;
}

.market-label {
    color: var(--text-secondary);
}

/* Nav user */
.nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--glass-border-hover);
}

.nav-btn--logout:hover {
    color: var(--loss);
    border-color: rgba(255, 61, 113, 0.3);
    background: var(--loss-bg);
}

/* ══════════════════════════════════════════════════════════════════════════════
   OVERVIEW CARDS
   ══════════════════════════════════════════════════════════════════════════════ */
.overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    padding: var(--space-xl) var(--space-xl) 0;
}

.overview-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out calc(var(--delay) * 0.08s) both;
}

.overview-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow);
}

.overview-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.overview-icon--portfolio {
    background: rgba(79, 124, 255, 0.12);
    color: var(--accent-primary);
}

.overview-icon--day-pnl {
    background: rgba(0, 214, 143, 0.12);
    color: var(--profit);
}

.overview-icon--total-pnl {
    background: rgba(123, 97, 255, 0.12);
    color: var(--accent-secondary);
}

.overview-icon--cash {
    background: rgba(255, 170, 0, 0.12);
    color: var(--warning);
}

.overview-card-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.overview-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.overview-value {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    white-space: nowrap;
}

.overview-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DASHBOARD GRID
   ══════════════════════════════════════════════════════════════════════════════ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-xl);
    padding: var(--space-xl);
    align-items: start;
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* ── Glass Card (base for all sections) ─────────────────────────────────────── */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    transition: all 0.3s ease;
}

.glass-card:hover {
    border-color: var(--glass-border-hover);
}

.section-card {
    padding: var(--space-lg);
    animation: fadeInUp 0.5s ease-out both;
}

.sidebar-card {
    animation: slideInRight 0.5s ease-out calc(var(--delay, 0) * 0.1s) both;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-primary);
}

.section-title svg {
    color: var(--accent-primary);
    flex-shrink: 0;
}

.section-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(79, 124, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(79, 124, 255, 0.2);
}

/* ── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) var(--space-md);
    color: var(--text-dim);
    gap: var(--space-md);
}

.empty-state p {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════════════
   HOLDINGS GRID
   ══════════════════════════════════════════════════════════════════════════════ */
.holdings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

.holding-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: all 0.3s ease;
    animation: fadeInUp 0.4s ease-out calc(var(--delay, 0) * 0.06s) both;
}

.holding-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.holding-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.holding-symbol {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.holding-pnl {
    font-size: 0.88rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.holding-pnl.positive {
    color: var(--profit);
    background: var(--profit-bg);
}

.holding-pnl.negative {
    color: var(--loss);
    background: var(--loss-bg);
}

.holding-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs) var(--space-md);
    margin-bottom: var(--space-sm);
}

.holding-detail {
    display: flex;
    flex-direction: column;
}

.holding-detail-label {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.holding-detail-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Allocation bar */
.holding-alloc-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
    margin-top: var(--space-xs);
}

.holding-alloc-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent-gradient);
    transition: width 0.8s ease;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TRADE HISTORY TABLE
   ══════════════════════════════════════════════════════════════════════════════ */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.data-table th {
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

.data-table td {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.data-table tbody tr:hover {
    background: rgba(79, 124, 255, 0.06);
}

.empty-row td {
    border-bottom: none;
}

/* Action badges in table */
.action-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.action-badge--buy {
    color: var(--profit);
    background: var(--profit-bg);
}

.action-badge--sell {
    color: var(--loss);
    background: var(--loss-bg);
}

.action-badge--hold {
    color: var(--neutral);
    background: rgba(143, 155, 179, 0.12);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
}

.status-badge--success {
    color: var(--profit);
    background: var(--profit-bg);
}

.status-badge--pending {
    color: var(--warning);
    background: var(--warning-bg);
}

.status-badge--failed {
    color: var(--loss);
    background: var(--loss-bg);
}

/* ══════════════════════════════════════════════════════════════════════════════
   AGENT STATUS
   ══════════════════════════════════════════════════════════════════════════════ */
.agent-status-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.agent-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xs) 0;
}

.agent-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.agent-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.agent-badge--running {
    color: var(--profit);
    background: var(--profit-bg);
    border: 1px solid rgba(0, 214, 143, 0.25);
}

.agent-badge--running::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--profit);
    animation: pulse 2s ease-in-out infinite;
}

.agent-badge--stopped {
    color: var(--loss);
    background: var(--loss-bg);
    border: 1px solid rgba(255, 61, 113, 0.25);
}

.agent-badge--market-closed {
    color: var(--warning);
    background: var(--warning-bg);
    border: 1px solid rgba(255, 170, 0, 0.25);
}

.agent-badge--idle {
    color: var(--neutral);
    background: rgba(143, 155, 179, 0.12);
    border: 1px solid rgba(143, 155, 179, 0.2);
}

/* ══════════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.btn--primary {
    background: var(--accent-gradient);
    color: #fff;
}

.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(79, 124, 255, 0.35);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--full {
    width: 100%;
    margin-top: var(--space-sm);
}

.btn--loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn--loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ══════════════════════════════════════════════════════════════════════════════
   AI SIGNALS
   ══════════════════════════════════════════════════════════════════════════════ */
.signals-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
}

.signal-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: all 0.3s ease;
}

.signal-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border-hover);
}

.signal-card--buy {
    border-left: 3px solid var(--profit);
}

.signal-card--sell {
    border-left: 3px solid var(--loss);
}

.signal-card--hold {
    border-left: 3px solid var(--neutral);
}

.signal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.signal-symbol {
    font-weight: 800;
    font-size: 0.92rem;
}

.signal-action {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.signal-action--buy {
    color: var(--profit);
    background: var(--profit-bg);
    box-shadow: 0 0 12px rgba(0, 214, 143, 0.2);
}

.signal-action--sell {
    color: var(--loss);
    background: var(--loss-bg);
    box-shadow: 0 0 12px rgba(255, 61, 113, 0.2);
}

.signal-action--hold {
    color: var(--neutral);
    background: rgba(143, 155, 179, 0.12);
}

.signal-reason {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: var(--space-sm);
}

.signal-confidence {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.signal-confidence-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.confidence-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s ease;
}

.confidence-fill--high {
    background: var(--profit);
}

.confidence-fill--medium {
    background: var(--warning);
}

.confidence-fill--low {
    background: var(--loss);
}

.signal-confidence-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 30px;
    text-align: right;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RISK MANAGEMENT
   ══════════════════════════════════════════════════════════════════════════════ */
.risk-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.risk-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.risk-item:last-child {
    border-bottom: none;
}

.risk-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.risk-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.risk-item--meter {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
}

.risk-item--meter .risk-label {
    text-align: left;
}

.drawdown-meter {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.drawdown-bar {
    height: 100%;
    border-radius: 4px;
    background: var(--accent-gradient);
    transition: width 0.8s ease;
}

.drawdown-bar.warning {
    background: linear-gradient(90deg, var(--warning), var(--loss));
}

.drawdown-bar.danger {
    background: var(--loss);
}

.drawdown-label {
    position: absolute;
    right: 0;
    top: -18px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════════════════════
   CHARTS
   ══════════════════════════════════════════════════════════════════════════════ */
.chart-container {
    width: 100%;
    position: relative;
}

.chart-container canvas {
    width: 100% !important;
    height: auto !important;
}

.chart-container--donut {
    display: flex;
    justify-content: center;
    padding: var(--space-sm) 0;
}

.chart-container--donut canvas {
    max-width: 220px;
    max-height: 220px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-md);
    padding-top: var(--space-md);
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   ACTIVITY LOG
   ══════════════════════════════════════════════════════════════════════════════ */
.log-feed {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-xs);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    font-size: 0.8rem;
    animation: fadeIn 0.3s ease-out;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.03);
}

.log-time {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
    min-width: 52px;
    flex-shrink: 0;
    font-family: 'Inter', monospace;
    padding-top: 1px;
}

.log-level {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    min-width: 38px;
    text-align: center;
}

.log-level--info {
    color: var(--accent-primary);
    background: rgba(79, 124, 255, 0.12);
}

.log-level--success {
    color: var(--profit);
    background: var(--profit-bg);
}

.log-level--warning {
    color: var(--warning);
    background: var(--warning-bg);
}

.log-level--error {
    color: var(--loss);
    background: var(--loss-bg);
}

.log-level--trade {
    color: var(--accent-secondary);
    background: rgba(123, 97, 255, 0.12);
}

.log-msg {
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════════════ */
#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 380px;
    pointer-events: auto;
    animation: toastIn 0.4s ease-out;
}

.toast--removing {
    animation: toastOut 0.3s ease-in forwards;
}

.toast--success {
    border-left: 3px solid var(--profit);
}

.toast--error {
    border-left: 3px solid var(--loss);
}

.toast--info {
    border-left: 3px solid var(--accent-primary);
}

.toast-icon {
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ══════════════════════════════════════════════════════════════════════════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(10, 14, 39, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(79, 124, 255, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════════════════════ */
.dashboard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    font-size: 0.72rem;
    color: var(--text-dim);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    margin-top: var(--space-md);
}

/* ══════════════════════════════════════════════════════════════════════════════
   P&L COLORING UTILITIES
   ══════════════════════════════════════════════════════════════════════════════ */
.text-profit {
    color: var(--profit) !important;
}

.text-loss {
    color: var(--loss) !important;
}

.text-neutral {
    color: var(--neutral) !important;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ══════════════════════════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr 340px;
        gap: var(--space-md);
        padding: var(--space-md);
    }

    .overview {
        padding: var(--space-md) var(--space-md) 0;
    }
}

/* Large mobile / small tablet */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

    .login-features {
        grid-template-columns: 1fr;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .navbar {
        padding: 0 var(--space-md);
        height: 56px;
    }

    .nav-title {
        display: none;
    }

    .nav-user-name {
        display: none;
    }

    .market-label {
        display: none;
    }

    .overview {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
        padding: var(--space-md) var(--space-md) 0;
    }

    .overview-value {
        font-size: 1.2rem;
    }

    .dashboard-grid {
        padding: var(--space-md);
        gap: var(--space-md);
    }

    .section-card {
        padding: var(--space-md);
    }

    .holdings-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-footer {
        flex-direction: column;
        gap: var(--space-xs);
        text-align: center;
        padding: var(--space-md);
    }

    .login-title {
        font-size: 1.8rem;
    }

    .login-subtitle {
        font-size: 1rem;
    }

    .login-btn {
        padding: 14px 32px;
        font-size: 0.95rem;
    }

    #login-screen {
        padding: var(--space-md);
    }
}

/* Small mobile */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .data-table {
        font-size: 0.78rem;
    }

    .data-table th,
    .data-table td {
        padding: var(--space-xs) var(--space-sm);
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════════════════════════════════════ */
@media print {
    body {
        background: #fff;
        color: #000;
    }

    .navbar,
    .login-bg-orbs,
    #toast-container,
    .loading-overlay,
    .btn {
        display: none !important;
    }

    .glass-card {
        background: #fff;
        border: 1px solid #ddd;
        box-shadow: none;
        backdrop-filter: none;
    }
}
