/* ============================================
   ACADEMY HUB — TradingON Theme
   Palette: Navy + Gold · Fonts: Instrument Serif + DM Sans + JetBrains Mono
   ============================================ */

:root {
    /* TradingON palette */
    --navy: #0A0E1A;
    --navy-light: #111827;
    --navy-mid: #1a2035;
    --gold: #FAB900;
    --gold-soft: #FAB90033;
    --white: #F5F5F0;
    --white-dim: #F5F5F0AA;
    --white-faint: rgba(245,245,240,0.4);
    --green: #34D399;
    --red: #EF4444;
    --blue: #0184CD;
    --orange: #F89319;

    /* Fonts */
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Legacy aliases (preserve existing class contracts) */
    --bg-primary: var(--navy);
    --bg-secondary: var(--navy-light);
    --bg-tertiary: var(--navy-mid);
    --bg-card: var(--navy-light);
    --bg-card-hover: var(--navy-mid);
    --bg-input: #0d1322;
    --bg-main: var(--navy);

    --gradient-primary: var(--gold);
    --gradient-accent: var(--gold);
    --gradient-glow: rgba(250,185,0,0.12);
    --gradient-sidebar: var(--navy-light);

    --text-primary: var(--white);
    --text-secondary: var(--white-dim);
    --text-muted: var(--white-faint);
    --text-accent: var(--gold);

    --accent-blue: var(--gold);
    --accent-purple: var(--gold);
    --accent-cyan: var(--blue);
    --accent-green: var(--green);
    --accent-red: var(--red);
    --accent-orange: var(--orange);
    --accent-gold: var(--gold);

    --discord-blue: #5865F2;
    --discord-dark: #0d1322;
    --discord-darker: #0a0e1a;
    --discord-darkest: #05070d;
    --discord-green: var(--green);

    --border-color: rgba(245,245,240,0.08);
    --border-subtle: rgba(245,245,240,0.06);
    --border-active: rgba(250,185,0,0.5);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px rgba(250,185,0,0.08);
    --shadow-glow-strong: 0 0 48px rgba(250,185,0,0.15);

    --sidebar-width: 280px;
    --sidebar-collapsed: 72px;

    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === 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: var(--font-body);
    background-color: var(--navy);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* === BACKGROUND (subtle TradingON radial accents) === */
.bg-animated {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 40% at 15% 20%, rgba(250,185,0,0.035) 0%, transparent 60%),
        radial-gradient(ellipse 50% 35% at 85% 75%, rgba(1,132,205,0.025) 0%, transparent 55%);
}

.bg-grid,
.bg-orb,
.bg-orb--1,
.bg-orb--2,
.bg-orb--3,
.bg-scanline,
.bg-candles {
    display: none;
}

/* === ANIMATIONS === */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    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 pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes typing {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* === LOGIN PAGE === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 0 20px;
    animation: fadeInUp 0.6s ease-out;
}

.login-card {
    background: var(--navy-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.login-header {
    padding: 2.5rem 2rem 1.5rem;
    text-align: center;
}

.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.5rem;
    border-radius: 16px;
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 2rem;
}

.login-title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 0.75rem;
    color: var(--white);
}

.login-title em { font-style: italic; color: var(--gold); }

.login-subtitle {
    color: var(--white-dim);
    font-size: 0.95rem;
    line-height: 1.6;
}

.login-body { padding: 1.5rem 2rem 2.5rem; }

.login-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    gap: 1rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.login-divider span {
    font-family: var(--font-mono);
    color: var(--white-faint);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Discord button (kept for login flow) */
.btn-discord {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.9rem 1.5rem;
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-discord:hover {
    background: var(--gold);
    color: var(--navy);
}

.btn-discord svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.auth-step { display: none; animation: fadeIn 0.3s ease; }
.auth-step.active { display: block; }

.discord-auth-modal {
    background: var(--navy-mid);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
}

.discord-auth-modal h3 {
    font-family: var(--font-display);
    color: var(--white);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 400;
}

.discord-auth-modal p {
    color: var(--white-dim);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.auth-permissions {
    text-align: left;
    background: var(--navy);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.auth-permissions li {
    list-style: none;
    padding: 0.5rem 0;
    color: var(--white-dim);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-permissions li::before {
    content: '✓';
    color: var(--gold);
    font-weight: 700;
}

.btn-authorize {
    width: 100%;
    padding: 0.85rem;
    background: var(--gold);
    color: var(--navy);
    border: none;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-authorize:hover { background: #ffc933; }

.btn-cancel-auth {
    width: 100%;
    padding: 0.6rem;
    background: transparent;
    color: var(--white-dim);
    border: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 0.5rem;
}

.auth-loading { padding: 3rem 2rem; text-align: center; }
.auth-loading .loading-spinner { margin-bottom: 1.5rem; }
.auth-loading p { color: var(--white-dim); font-size: 0.9rem; }

.auth-error-banner {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    color: #f87171;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 2rem 1rem;
}

.login-hint {
    margin-top: 1rem;
    color: var(--white-muted, rgba(255,255,255,0.35));
    font-size: 0.78rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.role-check { padding: 2rem; text-align: center; }

.role-check-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.role-check-icon.success { background: rgba(52,211,153,0.15); color: var(--green); }
.role-check-icon.error { background: rgba(239,68,68,0.15); color: var(--red); }

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 500;
    margin: 0.25rem;
}

.role-badge.academy {
    background: rgba(1,132,205,0.12);
    color: var(--blue);
    border: 1px solid rgba(1,132,205,0.3);
}

.role-badge.premium {
    background: var(--gold-soft);
    color: var(--gold);
    border: 1px solid rgba(250,185,0,0.3);
}

/* === MAIN LAYOUT === */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 150;
    background: var(--navy-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-smooth);
    overflow: hidden;
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
}

.brand-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 3px;
    color: var(--white);
    text-transform: uppercase;
}

.brand-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--white-faint);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    padding: 0 0.75rem;
    margin-bottom: 1.75rem;
}

.nav-section-title {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--white-faint);
    padding: 0 0.75rem;
    margin-bottom: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    border-radius: 8px;
    color: var(--white-dim);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 400;
    transition: all var(--transition-base);
    position: relative;
    cursor: pointer;
    margin-bottom: 2px;
    border: 1px solid transparent;
    overflow: hidden;
}

.nav-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translate(-4px, -50%);
    width: 3px;
    height: 0;
    background: var(--gold);
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: height var(--transition-base), opacity var(--transition-base), transform var(--transition-base);
}

.nav-item:hover {
    background: rgba(250,185,0,0.07);
    color: var(--white);
    border-color: rgba(250,185,0,0.25);
    transform: translateX(3px);
    box-shadow: 0 2px 12px rgba(250,185,0,0.08);
}

.nav-item:hover::after {
    height: 60%;
    opacity: 1;
    transform: translate(0, -50%);
}

.nav-item:hover .nav-icon {
    color: var(--gold);
    transform: scale(1.1);
}

.nav-item .nav-icon {
    transition: color var(--transition-base), transform var(--transition-base);
}

.nav-item:hover .nav-label {
    letter-spacing: 0.3px;
}

.nav-item .nav-label {
    transition: letter-spacing var(--transition-base);
}

.nav-item:hover .nav-badge {
    transform: scale(1.05);
}

.nav-item .nav-badge {
    transition: transform var(--transition-base);
}

.nav-item.active {
    background: rgba(250,185,0,0.06);
    color: var(--white);
    border-color: rgba(250,185,0,0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 60%;
    background: var(--gold);
}

.nav-item.primary {
    background: rgba(250,185,0,0.05);
    border-color: rgba(250,185,0,0.18);
    margin-bottom: 0.5rem;
}

.nav-item.primary:hover {
    background: rgba(250,185,0,0.1);
    border-color: rgba(250,185,0,0.35);
}

.nav-item.primary .nav-icon { color: var(--gold); }

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: var(--white-dim);
    flex-shrink: 0;
}

.nav-item.active .nav-icon { color: var(--gold); }

.nav-item .nav-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item .nav-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-badge.new,
.nav-badge.free { background: rgba(52,211,153,0.1); color: var(--green); }
.nav-badge.hot { background: rgba(239,68,68,0.1); color: var(--red); }
.nav-badge.ai { background: var(--gold-soft); color: var(--gold); }
.nav-badge.soon { background: rgba(245,245,240,0.05); color: var(--white-faint); }

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all var(--transition-base);
    cursor: pointer;
}

.user-profile:hover {
    background: rgba(245,245,240,0.03);
    border-color: var(--border-subtle);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--gold);
    text-transform: uppercase;
    margin-top: 2px;
}

.user-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-smooth);
    overflow-x: hidden;
}

.content-wrapper {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    min-width: 0;
}

.page-header {
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease-out;
}

.page-title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 0.25rem;
}

.page-title .highlight { color: var(--gold); font-style: italic; }

.page-description {
    color: var(--white-dim);
    font-size: 0.95rem;
}

/* === CHATBOT === */
.chatbot-container {
    height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    background: var(--navy-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-header-left { display: flex; align-items: center; gap: 0.85rem; }
.chat-header-right { display: flex; align-items: center; }

.chat-reset-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: transparent;
    color: var(--white-dim);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-base);
}

.chat-reset-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.chat-reset-btn i { font-size: 0.7rem; }

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.chat-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--white);
}

.chat-title .caimi-name { font-weight: 400; }
.chat-title .caimi-name .ai-highlight { color: var(--gold); font-style: italic; }
.chat-title .caimi-name .ai-highlight-free { color: var(--green); font-style: italic; }

.free-avatar {
    background: rgba(52,211,153,0.15) !important;
    color: var(--green) !important;
}

.free-dot { background: var(--green) !important; }

.chat-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--white-dim);
    margin-top: 2px;
}

.chat-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(245,245,240,0.1);
    border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(245,245,240,0.2); }

.message { max-width: 80%; animation: fadeInUp 0.3s ease-out; }
.message.bot { align-self: flex-start; }
.message.user { align-self: flex-end; }

.message-bubble {
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    font-size: 0.92rem;
    line-height: 1.65;
    position: relative;
}

.message.bot .message-bubble {
    background: var(--navy-mid);
    border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px;
    color: var(--white);
}

.message.user .message-bubble {
    background: var(--gold);
    color: var(--navy);
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

.message-time {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 1px;
    color: var(--white-faint);
    margin-top: 0.35rem;
    padding: 0 0.25rem;
}

.message.user .message-time { text-align: right; }

.message-sources {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--white-faint);
    margin-top: 0.5rem;
    padding: 0 0.25rem;
    line-height: 1.8;
}

.message-sources a {
    color: var(--gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.message-sources a:hover {
    color: var(--white);
    text-decoration: underline;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.9rem 1.2rem;
    background: var(--navy-mid);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

/* Vecchio stile a pallini (usato dal widget floating) */
.typing-indicator span:not(.typing-spinner):not(.typing-text):not(.typing-timer) {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--white-faint);
    animation: typing 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2):not(.typing-text) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3):not(.typing-timer) { animation-delay: 0.4s; }

/* Nuovo stile status (chatbot principale e free) */
.typing-indicator--status {
    gap: 0.65rem;
    padding: 0.75rem 1.1rem;
    max-width: 340px;
}

.typing-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(250,185,0,0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex: 0 0 auto;
}

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

.typing-text {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: rgba(245,245,240,0.6);
    letter-spacing: 0.01em;
    flex: 1;
    animation: none;
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
}

.typing-timer {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(245,245,240,0.25);
    flex: 0 0 auto;
    animation: none;
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    min-width: 2.5ch;
    text-align: right;
}

/* Chat Input */
.chat-input-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: transparent;
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: var(--navy);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: border-color var(--transition-base);
}

.chat-input-wrapper:focus-within {
    border-color: var(--gold);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.92rem;
    padding: 0.5rem 0.25rem;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
}

.chat-input::placeholder { color: var(--white-faint); }

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--gold);
    border: none;
    color: var(--navy);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.chat-send-btn:hover { background: #ffc933; }
.chat-send-btn:active { transform: scale(0.95); }

.chat-send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--white-faint);
}

.chat-send-btn svg { width: 18px; height: 18px; }

/* === WELCOME SCREEN === */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.welcome-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    margin-bottom: 1.75rem;
}
.welcome-icon.welcome-icon--img {
    width: 140px;
    height: 140px;
    border-radius: 20px;
    overflow: hidden;
    padding: 4px;
    margin-bottom: 0.75rem;
    font-size: 0;
}
.welcome-icon--img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.welcome-icon.welcome-icon--gold  { background: var(--gold-soft); }
.welcome-icon.welcome-icon--green { background: rgba(52, 211, 153, 0.15); }

.welcome-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 400;
    line-height: 1.1;
    color: var(--white);
    margin-bottom: 0.75rem;
}

.welcome-subtitle {
    color: var(--white-dim);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 460px;
    margin-bottom: 2.25rem;
}

.welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
    max-width: 640px;
}

.suggestion-chip {
    padding: 0.6rem 1.1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--white-dim);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.suggestion-chip:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* === SPINNER === */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(250,185,0,0.15);
    border-radius: 50%;
    border-top-color: var(--gold);
    animation: spin 1s ease-in-out infinite;
}

.loading-spinner.sm { width: 20px; height: 20px; border-width: 2px; }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: var(--gold);
    color: var(--navy);
}

.btn-primary:hover { background: #ffc933; }

.btn-ghost {
    background: transparent;
    border-color: var(--border-color);
    color: var(--white-dim);
}

.btn-ghost:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* === MODULE CARDS === */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.module-card {
    background: var(--navy-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    border-color: rgba(245,245,240,0.15);
    transform: translateY(-4px);
    background: var(--navy-mid);
}

.module-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}

.module-card-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--white);
}

.module-card-desc {
    color: var(--white-dim);
    font-size: 0.88rem;
    line-height: 1.55;
}

/* === TOASTS === */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--navy-mid);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--gold); }

.toast-message { flex: 1; font-size: 0.88rem; color: var(--white); }

.toast-close {
    background: none;
    border: none;
    color: var(--white-faint);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    line-height: 1;
}

/* === MOBILE SIDEBAR TOGGLE === */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--navy-light);
    border: 1px solid var(--border-color);
    color: var(--white);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-base);
}

.sidebar-toggle:hover { border-color: var(--gold); color: var(--gold); }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility 0s linear var(--transition-base);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition: opacity var(--transition-base), visibility 0s;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .main-content { margin-left: 0; }
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar-toggle { display: flex; }
    .content-wrapper { padding: 1.5rem; padding-top: 4rem; }
}

@media (max-width: 768px) {
    .content-wrapper { padding: 1rem; padding-top: 4rem; }
    .chatbot-container { height: calc(100vh - 5rem); border-radius: 10px; }
    .message { max-width: 92%; }
    .welcome-title { font-size: 2rem; }
    .welcome-suggestions { flex-direction: column; align-items: center; }
    .login-container { padding: 0 15px; }
    .module-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    body { font-size: 14px; }
    .login-header { padding: 2rem 1.5rem 1rem; }
    .login-body { padding: 1rem 1.5rem 2rem; }
    .page-title { font-size: 1.8rem; }
    .chat-header { padding: 0.85rem 1rem; }
    .chat-messages { padding: 1rem; }
    .chat-input-area { padding: 0.75rem 1rem; }
    .welcome-title { font-size: 1.75rem; }
}

@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* === SCROLLBAR GLOBAL === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(245,245,240,0.08);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(245,245,240,0.18); }

/* === UTILITIES === */
.text-gradient { color: var(--gold); font-style: italic; font-family: var(--font-display); }
.text-gradient-free { color: var(--green); font-style: italic; font-family: var(--font-display); }

.text-muted { color: var(--white-faint); }
.text-secondary { color: var(--white-dim); }
.text-accent { color: var(--gold); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* ===========================
   UPLOAD KNOWLEDGE
   =========================== */

.page-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
    background: var(--navy-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.upload-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.upload-section {
    max-width: 720px;
    margin: 0 auto;
}

.upload-section-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--white);
    margin-bottom: 0.5rem;
}

.upload-section-desc {
    color: var(--white-dim);
    font-size: 0.92rem;
    margin-bottom: 1.75rem;
}

/* Dropzone */
.upload-dropzone {
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--navy);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--gold);
    background: rgba(250,185,0,0.03);
}

.dropzone-icon {
    font-size: 2.25rem;
    color: var(--gold);
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.dropzone-text {
    color: var(--white-dim);
    font-size: 0.95rem;
}

.dropzone-link {
    color: var(--gold);
    cursor: pointer;
    text-decoration: underline;
}

.dropzone-hint {
    font-family: var(--font-mono);
    color: var(--white-faint);
    font-size: 0.7rem;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

.dropzone-filename {
    margin-top: 0.85rem;
    padding: 0.5rem 1rem;
    background: var(--gold-soft);
    border-radius: 4px;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    display: inline-block;
}

/* Divider */
.upload-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--white-faint);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.upload-divider::before,
.upload-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.upload-divider span { padding: 0 1rem; }

/* Textarea & title */
.upload-textarea {
    width: 100%;
    padding: 1rem;
    background: var(--navy);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.92rem;
    resize: vertical;
    min-height: 160px;
    transition: border-color 0.3s;
}

.upload-textarea:focus { outline: none; border-color: var(--gold); }

.upload-title-input {
    width: 100%;
    padding: 0.85rem 1rem;
    margin-top: 1rem;
    background: var(--navy);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: border-color 0.3s;
}

.upload-title-input:focus { outline: none; border-color: var(--gold); }

.upload-btn {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.95rem;
    background: var(--gold);
    border: none;
    border-radius: 8px;
    color: var(--navy);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover:not(:disabled) { background: #ffc933; }

.upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--white-faint);
}

/* Upload Progress Modal */
.upload-progress-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.upload-progress-overlay.active { display: flex; }

.upload-progress-modal {
    background: var(--navy-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.25rem 2.5rem;
    width: 460px;
    max-width: 90vw;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.upload-progress-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.upload-progress-header .upload-progress-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 1rem;
    background: var(--gold-soft);
    color: var(--gold);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.upload-progress-header .upload-progress-icon i { animation: spin 3s linear infinite; }

.upload-progress-header h3 {
    font-family: var(--font-display);
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
}

.upload-progress-bar-container {
    width: 100%;
    height: 4px;
    background: var(--navy);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.upload-progress-bar {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.5s ease;
    position: relative;
}

.upload-progress-percent {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--white-faint);
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    font-variant-numeric: tabular-nums;
}

.upload-progress-phases {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.upload-phase {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    transition: background 0.3s;
}

.upload-phase.active { background: rgba(250,185,0,0.05); }
.upload-phase.done { opacity: 0.6; }

.upload-phase .phase-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--navy-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--white-faint);
    flex-shrink: 0;
    transition: all 0.3s;
}

.upload-phase.active .phase-icon {
    background: var(--gold);
    color: var(--navy);
}

.upload-phase.done .phase-icon {
    background: rgba(52,211,153,0.15);
    color: var(--green);
}

.upload-phase .phase-content { flex: 1; min-width: 0; }

.upload-phase .phase-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--white-dim);
    transition: color 0.3s;
}

.upload-phase.active .phase-title { color: var(--white); }

.upload-phase .phase-detail {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--white-faint);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-phase .phase-status {
    flex-shrink: 0;
    font-size: 0.5rem;
    color: var(--white-faint);
    transition: color 0.3s;
}

.upload-phase.active .phase-status { color: var(--gold); }
.upload-phase.active .phase-status i { animation: pulse 1.2s ease-in-out infinite; }

.upload-phase.done .phase-status i::before {
    content: "\f00c";
    font-weight: 900;
}

.upload-phase.done .phase-status {
    color: var(--green);
    font-size: 0.7rem;
}

.upload-progress-elapsed {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--white-faint);
    margin-top: 1.5rem;
    font-variant-numeric: tabular-nums;
}

/* Review */
.review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.review-stats {
    display: flex;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.review-stats span {
    padding: 0.35rem 0.7rem;
    background: var(--gold-soft);
    border-radius: 4px;
    color: var(--gold);
    letter-spacing: 1px;
}

.review-questions { margin-bottom: 1.5rem; }

.review-questions h4 {
    font-family: var(--font-mono);
    color: var(--white-dim);
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 0.85rem;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.review-chat {
    background: var(--navy);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.review-messages {
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
}

.review-chat .chat-input-area { border-top: 1px solid var(--border-color); }

.review-actions { display: flex; gap: 1rem; }

.review-btn {
    flex: 1;
    padding: 0.95rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.review-btn.confirm {
    background: var(--green);
    color: var(--navy);
}

.review-btn.confirm:hover:not(:disabled) { background: #52e3a7; }
.review-btn.confirm.confirmed { background: #1fb57a; color: var(--white); }

.review-btn.delete {
    background: transparent;
    color: var(--red);
    border-color: rgba(239,68,68,0.35);
}

.review-btn.delete:hover:not(:disabled) {
    background: rgba(239,68,68,0.1);
    border-color: var(--red);
}

.review-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Upload target selector */
.upload-target-selector { margin-bottom: 1.75rem; }

.upload-target-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--white-dim);
    margin-bottom: 0.85rem;
    font-weight: 500;
}

.target-options { display: flex; gap: 0.75rem; }

.target-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1.15rem 1rem;
    background: var(--navy);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--white-dim);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.target-btn i { font-size: 1.3rem; margin-bottom: 0.2rem; }

.target-btn span {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--white);
}

.target-btn small {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--white-faint);
}

.target-btn:hover {
    border-color: rgba(245,245,240,0.2);
    background: var(--navy-mid);
}

.target-btn.active[data-target="main"] {
    border-color: var(--gold);
    background: rgba(250,185,0,0.05);
    color: var(--gold);
}

.target-btn.active[data-target="main"] i,
.target-btn.active[data-target="main"] span { color: var(--gold); }

.target-btn.active[data-target="free"] {
    border-color: var(--green);
    background: rgba(52,211,153,0.05);
    color: var(--green);
}

.target-btn.active[data-target="free"] i,
.target-btn.active[data-target="free"] span { color: var(--green); }

/* ===========================
   TILE GRID LANDING
   =========================== */

.dashboard-grid {
    animation: fadeInUp 0.5s ease-out;
    min-width: 0;
    max-width: 100%;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.tile {
    all: unset;
    aspect-ratio: 1 / 1;
    background: var(--navy-light);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    color: var(--white);
    box-sizing: border-box;
    transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.tile::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 120%, rgba(250,185,0,0.08) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tile:hover {
    transform: translateY(-4px);
    border-color: rgba(250,185,0,0.35);
    background: var(--navy-mid);
}

.tile:hover::after { opacity: 1; }

.tile:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.tile-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.tile-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--white-dim);
}

.tile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--green);
}

.tile-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
}

.tile-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 0;
}

.tile-gauge {
    width: 85%;
    max-width: 180px;
    height: auto;
    margin-bottom: 0.4rem;
}

.tile-value {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 2.75rem);
    line-height: 1;
    color: var(--gold);
}

.tile-class {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--orange);
    margin-top: 0.2rem;
}

.tile-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--white-dim);
    transition: color 0.3s ease;
    flex-shrink: 0;
}

.tile:hover .tile-foot { color: var(--gold); }

.tile-foot i {
    transition: transform 0.3s ease;
}

.tile:hover .tile-foot i { transform: translateX(3px); }

/* Bitcoin tile */
.tile--btc { position: relative; }

.tile--btc::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 15% 10%, rgba(250,185,0,0.10), transparent 55%),
        radial-gradient(ellipse 60% 50% at 90% 95%, rgba(248,147,25,0.06), transparent 55%);
    pointer-events: none;
    z-index: 0;
}

.tile--btc > * { position: relative; z-index: 1; }

.btc-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--navy);
    font-weight: 700;
    font-size: 0.75rem;
    font-family: var(--font-body);
    margin-right: 0.3rem;
    vertical-align: -3px;
}

.btc-ic--lg {
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
    margin-right: 0.85rem;
    vertical-align: middle;
}

.tile-label .btc-ic { margin-right: 0.2rem; }

.tile-badge--change {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    padding: 0.22rem 0.55rem;
    border-radius: 4px;
    color: var(--navy);
    background: var(--green);
    text-transform: none;
}

.tile-badge--change.down {
    background: var(--red);
    color: var(--white);
}

.tile-body--btc {
    position: relative;
    justify-content: flex-end;
    padding-bottom: 0.4rem;
    gap: 0;
}

.btc-sparkline {
    position: absolute;
    left: -1.25rem;
    right: -1.25rem;
    top: 30%;
    bottom: 30%;
    pointer-events: none;
    opacity: 0.9;
}

.btc-sparkline svg {
    width: 100%;
    height: 100%;
    display: block;
}

.btc-price {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 5.5vw, 2.9rem);
    line-height: 1;
    color: var(--white);
    letter-spacing: -0.5px;
    text-align: center;
    z-index: 1;
    margin-top: auto;
}

.tile-foot--btc {
    text-transform: none;
    letter-spacing: 0;
    align-items: center;
}

.btc-dominance {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.btc-dom-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--white-faint);
}

.btc-dom-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.5px;
}

/* Placeholder tile */
.tile--placeholder {
    border-style: dashed;
    border-color: var(--border-subtle);
    cursor: default;
    opacity: 0.5;
}

.tile--placeholder:hover {
    transform: none;
    border-color: var(--border-subtle);
    background: var(--navy-light);
}

.tile--placeholder::after { display: none; }

.tile-body--empty {
    color: var(--white-faint);
    font-size: 2rem;
}

/* ===========================
   DETAIL MODAL
   =========================== */

/* Modal scrolls natively as a block container (no flex centering, no nested overflow:auto) */
.detail-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.detail-modal.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s;
}

/* Backdrop is fixed so it covers the viewport and does not scroll with content */
.detail-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 0;
}

.detail-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: var(--navy);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    padding-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

/* Close button is fixed to the viewport — always reachable while scrolling */
.detail-close {
    position: fixed;
    top: 1.2rem;
    right: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--white-dim);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    z-index: 510;
}

.detail-close:hover,
.detail-close:active {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(10, 14, 26, 0.95);
}

@media (max-width: 640px) {
    .detail-modal { padding: 0; }
    .detail-content {
        padding: 2.5rem 0.9rem 1.5rem;
        border-radius: 0;
        gap: 0.9rem;
        border-left: none;
        border-right: none;
        min-height: 100vh;
        min-height: 100dvh;
    }
    .detail-close {
        top: 0.6rem;
        right: 0.6rem;
        width: 36px;
        height: 36px;
    }
}

body.detail-open {
    overflow: hidden;
    overscroll-behavior: contain;
}

/* BTC modal */
.btc-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.btc-modal-title {
    display: flex;
    align-items: center;
}

.btc-modal-title h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--white);
    line-height: 1.1;
}

.btc-modal-title .btc-sym {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--white-faint);
    margin-left: 0.5rem;
    vertical-align: middle;
}

.btc-modal-price-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.3rem;
}

.btc-modal-price {
    font-family: var(--font-display);
    font-size: 1.75rem;
    color: var(--gold);
    line-height: 1;
}

.btc-modal-stats {
    display: flex;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.btc-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btc-stat-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--white-faint);
}

.btc-stat-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
}

.btc-chart-card { padding: 1.25rem; }

.btc-chart-wrap {
    width: 100%;
    height: 460px;
    min-height: 320px;
    background: var(--navy);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    position: relative;
}

@media (max-width: 640px) {
    .btc-modal-head { gap: 1rem; }
    .btc-modal-title h2 { font-size: 1.4rem; }
    .btc-modal-price { font-size: 1.4rem; }
    .btc-modal-stats { gap: 1rem; }
    .btc-stat-value { font-size: 0.9rem; }
    .btc-chart-wrap { height: 320px; }
    .btc-ic--lg { width: 36px; height: 36px; font-size: 1.25rem; }
}

/* ===========================
   FEAR & GREED DASHBOARD
   =========================== */

.fg-dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
    max-width: 100%;
    animation: fadeInUp 0.5s ease-out;
}

.fg-dashboard * { min-width: 0; }

.fg-hero {
    padding: 0.5rem 0 0.5rem;
}

.fg-hero-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3vw, 2.75rem);
    font-weight: 400;
    line-height: 1.1;
    color: var(--gold);
    margin-bottom: 0.85rem;
}

.fg-hero-title em { font-style: italic; color: var(--white); }

.fg-hero-sub {
    color: var(--white-dim);
    font-size: 0.95rem;
    line-height: 1.65;
    max-width: 720px;
}

.fg-card {
    background: var(--navy-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: hidden;
}

/* Summary: gauge | historical | yearly, horizontal */
.fg-summary-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.fg-summary-grid > .fg-section { margin-top: 0; }

.fg-card-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--gold);
    margin-bottom: 1.25rem;
}

/* Gauge cell (inside summary grid) */
.fg-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0;
}

.fg-gauge-svg {
    width: 100%;
    max-width: 240px;
    height: auto;
}

.fg-gauge-value {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 400;
    line-height: 1;
    margin-top: 0.5rem;
    color: var(--gold);
}

.fg-gauge-class {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--orange);
    margin-top: 0.4rem;
}

.fg-gauge-desc {
    font-size: 0.78rem;
    color: var(--white-dim);
    margin-top: 0.5rem;
    text-align: center;
}

.fg-section {
    margin-top: 1.25rem;
}

.fg-section-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--gold);
    margin-bottom: 0.75rem;
}

.fg-hist-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.fg-hist-row:last-child { border-bottom: none; }

.fg-hist-label {
    color: var(--white-dim);
    font-size: 0.88rem;
}

.fg-hist-label small {
    color: var(--white-faint);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    margin-left: 0.3rem;
}

.fg-pill {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--navy);
    background: var(--orange);
    white-space: nowrap;
}

.fg-pill--extreme_fear { background: #EF4444; color: #fff; }
.fg-pill--fear { background: #F89319; color: var(--navy); }
.fg-pill--neutral { background: #FAB900; color: var(--navy); }
.fg-pill--greed { background: #A3D977; color: var(--navy); }
.fg-pill--extreme_greed { background: #34D399; color: var(--navy); }

/* Chart card */
.fg-card--chart { min-height: 520px; }

.fg-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.fg-timeframes {
    display: flex;
    gap: 0.3rem;
    background: var(--navy);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 3px;
}

.fg-tf {
    padding: 0.4rem 0.85rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--white-dim);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.fg-tf:hover { color: var(--white); }

.fg-tf.active {
    background: var(--gold);
    color: var(--navy);
    font-weight: 600;
}

.fg-legend {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.fg-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--white-dim);
}

.fg-legend-item i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.fg-chart-wrap {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 400px;
}

.fg-chart-wrap canvas {
    max-width: 100% !important;
    height: 100% !important;
}

.fg-hist-row {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fg-timeframes { flex-wrap: wrap; }

/* Responsive */
@media (max-width: 1100px) {
    .fg-summary-grid {
        grid-template-columns: minmax(240px, 320px) 1fr;
        gap: 1.5rem;
    }
    .fg-summary-grid > .fg-gauge { grid-row: span 2; }
}

@media (max-width: 820px) {
    .fg-summary-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .fg-summary-grid > .fg-gauge { grid-row: auto; }
    .fg-card--chart { min-height: 460px; }
}

/* Correlations page */
.corr-page {
    padding: 2rem 2.25rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.corr-header { margin-bottom: 0.25rem; }
.corr-title {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    font-weight: 400;
    color: #F5F5F0;
    margin: 0;
    line-height: 1.1;
}
.corr-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: #F5F5F099;
    margin: 0.35rem 0 0;
}
.corr-card {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.6), rgba(10, 14, 26, 0.6));
    border: 1px solid rgba(245, 245, 240, 0.08);
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
}
.corr-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.corr-card-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #FAB900;
    font-weight: 600;
    margin: 0;
}
.corr-card-title small {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: #F5F5F099;
    letter-spacing: 0.1em;
    margin-left: 0.6rem;
}
.corr-range-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #F5F5F099;
}
.corr-error {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #F89319;
    max-width: 60%;
    text-align: right;
}
/* Range */
.corr-range {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
    justify-content: space-between;
}
.corr-pills { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.corr-pill {
    background: rgba(245, 245, 240, 0.05);
    border: 1px solid rgba(245, 245, 240, 0.08);
    color: #F5F5F0CC;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 0.45rem 0.85rem;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.corr-pill:hover { background: rgba(250, 185, 0, 0.1); color: #FAB900; }
.corr-pill.active {
    background: rgba(250, 185, 0, 0.2);
    border-color: #FAB900;
    color: #FAB900;
}
.corr-custom {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    color: #F5F5F0AA;
}
.corr-custom label { display: inline-flex; align-items: center; gap: 0.4rem; }
.corr-custom input[type="date"] {
    background: rgba(245, 245, 240, 0.04);
    border: 1px solid rgba(245, 245, 240, 0.12);
    border-radius: 6px;
    color: #F5F5F0;
    padding: 0.35rem 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color-scheme: dark;
}
.corr-custom-apply {
    background: rgba(250, 185, 0, 0.15);
    border: 1px solid rgba(250, 185, 0, 0.4);
    color: #FAB900;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.45rem 0.85rem;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.corr-custom-apply:hover { background: rgba(250, 185, 0, 0.25); }
/* Assets */
.corr-assets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}
.corr-chip {
    --chip-color: #FAB900;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(245, 245, 240, 0.04);
    border: 1px solid rgba(245, 245, 240, 0.1);
    border-left: 3px solid var(--chip-color);
    color: #F5F5F0;
    padding: 0.35rem 0.5rem 0.35rem 0.65rem;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    position: relative;
    transition: background 0.2s ease;
}
.corr-chip-logo { width: 18px; height: 18px; border-radius: 50%; }
.corr-chip-x {
    background: none;
    border: none;
    color: #F5F5F077;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    font-size: 0.7rem;
    padding: 0 0.15rem;
}
.corr-chip:hover { background: rgba(245, 245, 240, 0.08); }
.corr-chip:hover .corr-chip-x { opacity: 1; }
.corr-chip-x:hover { color: #EF4444; }
.corr-add-wrap { position: relative; }
.corr-add-btn {
    background: transparent;
    border: 1px dashed rgba(250, 185, 0, 0.45);
    color: #FAB900;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.corr-add-btn:hover:not(:disabled) {
    background: rgba(250, 185, 0, 0.1);
    border-style: solid;
}
.corr-add-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.corr-search {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(380px, 90vw);
    background: #111827;
    border: 1px solid rgba(245, 245, 240, 0.12);
    border-radius: 10px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
    padding: 0.6rem;
    z-index: 60;
}
.corr-search input {
    width: 100%;
    background: rgba(245, 245, 240, 0.04);
    border: 1px solid rgba(245, 245, 240, 0.1);
    color: #F5F5F0;
    padding: 0.5rem 0.7rem;
    border-radius: 7px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
}
.corr-search-results {
    max-height: 320px;
    overflow-y: auto;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
}
.corr-search-row {
    display: grid;
    grid-template-columns: 24px 56px 1fr auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.5rem;
    background: none;
    border: none;
    color: #F5F5F0;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
}
.corr-search-row:hover { background: rgba(250, 185, 0, 0.08); }
.corr-search-row img { width: 24px; height: 24px; border-radius: 50%; }
.corr-search-sym { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #FAB900; }
.corr-search-name { color: #F5F5F0AA; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.corr-search-rank { color: #F5F5F066; font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.corr-search-empty { padding: 1rem; text-align: center; color: #F5F5F099; font-size: 0.85rem; }
/* Matrix */
.corr-matrix-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: start;
    min-width: 0;
}
.corr-matrix {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    max-width: 100%;
}
.corr-m-table {
    border-collapse: separate;
    border-spacing: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
}
.corr-m-table th {
    background: transparent;
    color: #FAB900;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.5rem;
    text-align: center;
    font-size: 0.75rem;
}
.corr-m-table thead th:first-child { color: transparent; }
.corr-cell {
    min-width: 54px;
    height: 42px;
    text-align: center;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(245, 245, 240, 0.05);
    animation: corrCellFlip 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    backface-visibility: hidden;
    transform-origin: center;
}
.corr-cell--diag {
    background: transparent !important;
    color: transparent !important;
    box-shadow: none !important;
    pointer-events: none;
}
@keyframes corrCellFlip {
    0%   { transform: rotateY(90deg); opacity: 0; }
    60%  { opacity: 1; }
    100% { transform: rotateY(0deg);  opacity: 1; }
}
.corr-empty { text-align: center; color: #F5F5F099; padding: 2rem; font-family: 'DM Sans', sans-serif; }
/* Loader while computing */
.corr-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 3rem 1rem;
    min-height: 280px;
}
.corr-loader-scene {
    position: relative;
    width: 120px;
    height: 80px;
    perspective: 600px;
}
.corr-loader-card {
    position: absolute;
    top: 0;
    width: 50px;
    height: 80px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transform-origin: 100% 50%;
    backface-visibility: visible;
}
.corr-loader-card--a {
    left: 10px;
    background: linear-gradient(135deg, #34D399, #208E5C);
    animation: corrLoaderFlipA 1.6s ease-in-out infinite;
}
.corr-loader-card--b {
    left: 60px;
    background: linear-gradient(135deg, #EF4444, #A63535);
    transform-origin: 0 50%;
    animation: corrLoaderFlipB 1.6s ease-in-out infinite;
}
@keyframes corrLoaderFlipA {
    0%, 100% { transform: rotateY(0deg); }
    50%      { transform: rotateY(-180deg); }
}
@keyframes corrLoaderFlipB {
    0%, 100% { transform: rotateY(0deg); }
    50%      { transform: rotateY(180deg); }
}
.corr-loader-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #F5F5F099;
}
/* Legend */
.corr-legend {
    width: 72px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
}
.corr-legend-rail {
    position: relative;
    display: flex;
    gap: 0.6rem;
    height: 280px;
    align-items: stretch;
}
.corr-legend-bar {
    width: 20px;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(to top,
        #EF4444 0%,
        #A63535 15%,
        #4A3840 35%,
        #2A2E3A 50%,
        #1E4A3E 65%,
        #208E5C 85%,
        #34D399 100%);
    box-shadow: 0 0 0 1px rgba(245, 245, 240, 0.08);
}
.corr-legend-scale {
    position: relative;
    width: 36px;
    height: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #F5F5F0AA;
}
.corr-legend-scale span {
    position: absolute;
    left: 0;
    transform: translateY(-50%);
    line-height: 1;
}
.corr-legend-scale span:nth-child(1) { top: 0%; }
.corr-legend-scale span:nth-child(2) { top: 25%; }
.corr-legend-scale span:nth-child(3) { top: 50%; }
.corr-legend-scale span:nth-child(4) { top: 75%; }
.corr-legend-scale span:nth-child(5) { top: 100%; }
.corr-legend-caption {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.68rem;
    color: #F5F5F077;
    text-align: center;
    max-width: 120px;
    margin-top: 0.4rem;
}
/* Chart */
.corr-chart-wrap {
    height: 400px;
    position: relative;
}
.corr-chart-wrap canvas { max-width: 100% !important; height: 100% !important; }

@media (max-width: 820px) {
    .corr-page { padding: 1.25rem; }
    .corr-matrix-wrap { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .corr-legend {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    .corr-legend-rail {
        flex-direction: column;
        height: auto;
        gap: 0.35rem;
        align-items: stretch;
    }
    .corr-legend-bar {
        width: 100%;
        height: 18px;
        background: linear-gradient(to right,
            #EF4444 0%,
            #A63535 15%,
            #4A3840 35%,
            #2A2E3A 50%,
            #1E4A3E 65%,
            #208E5C 85%,
            #34D399 100%);
    }
    .corr-legend-scale {
        position: relative;
        width: 100%;
        height: 1rem;
        margin: 0;
    }
    .corr-legend-scale span {
        top: 0;
        transform: translateX(-50%);
    }
    .corr-legend-scale span:nth-child(1) { left: 100%; top: 0; }
    .corr-legend-scale span:nth-child(2) { left: 75%; top: 0; }
    .corr-legend-scale span:nth-child(3) { left: 50%; top: 0; }
    .corr-legend-scale span:nth-child(4) { left: 25%; top: 0; }
    .corr-legend-scale span:nth-child(5) { left: 0%; top: 0; }
    .corr-legend-scale span:first-child { transform: translateX(-100%); }
    .corr-legend-scale span:last-child { transform: translateX(0); }
    .corr-legend-caption { margin-top: 0.3rem; max-width: 100%; }
}

@media (max-width: 480px) {
    .corr-page { padding: 1rem 0.85rem 2rem; }
    .corr-card { padding: 1rem 0.9rem; border-radius: 12px; }
    .corr-card-title { font-size: 0.75rem; letter-spacing: 0.15em; }
    .corr-cell { min-width: 42px; height: 34px; font-size: 0.72rem; }
    .corr-m-table { border-spacing: 3px; font-size: 0.72rem; }
    .corr-m-table th { padding: 0.25rem 0.3rem; font-size: 0.7rem; }
    .corr-chart-wrap { height: 300px; }
}

/* ===========================
   PERFORMANCE REPORT PAGE
   =========================== */
.perf-page {
    padding: 2rem 2.25rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
}
.perf-header { margin-bottom: 0.25rem; }
.perf-title {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    font-weight: 400;
    color: #F5F5F0;
    margin: 0;
    line-height: 1.1;
}
.perf-title-accent { color: var(--gold); font-style: italic; }
.perf-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: #F5F5F099;
    margin: 0.35rem 0 0;
}

/* Tabs */
.perf-tabs {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.perf-tabs::-webkit-scrollbar { display: none; }

.perf-tab {
    padding: 0.55rem 1.1rem;
    background: rgba(245, 245, 240, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--white-dim);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}
.perf-tab:hover {
    background: rgba(250, 185, 0, 0.08);
    color: var(--white);
    border-color: rgba(250, 185, 0, 0.25);
}
.perf-tab.active {
    background: var(--gold);
    color: var(--navy);
    border-color: var(--gold);
    font-weight: 700;
}

.perf-panel { display: none; }
.perf-panel.active {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: perfPanelIn 0.3s ease-out;
}
@keyframes perfPanelIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Period pills wrap */
.perf-period-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* Capital simulator input */
.perf-capital-input {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(10, 14, 26, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--white-dim);
    transition: border-color 0.2s;
}
.perf-capital-input:focus-within {
    border-color: var(--gold);
}
.perf-capital-input > span {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
    color: var(--white-faint);
}
.perf-capital-currency { color: var(--gold) !important; font-size: 0.85rem !important; letter-spacing: 0 !important; }
.perf-capital-input input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    width: 100px;
    padding: 0;
    -moz-appearance: textfield;
}
.perf-capital-input input::-webkit-outer-spin-button,
.perf-capital-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Stats grid */
.perf-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75rem;
    min-width: 0;
}
.perf-stat {
    background: rgba(17, 24, 39, 0.55);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.perf-stat-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--white-faint);
}
.perf-stat-value {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 400;
    color: var(--white);
    line-height: 1.15;
    word-break: break-word;
}
.perf-stat-sub {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--white-faint);
    letter-spacing: 0.05em;
}
.perf-stat--pos .perf-stat-value { color: #34D399; }
.perf-stat--neg .perf-stat-value { color: #EF4444; }
.perf-stat--neutral .perf-stat-value { color: var(--gold); }

.perf-stats-detail { margin-top: .75rem; }
.perf-stats-detail--hidden { display: none !important; }

.perf-detail-btn {
    font-family: 'DM Sans', sans-serif;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .3rem .75rem;
    border-radius: 20px;
    border: 1px solid rgba(250,185,0,.35);
    background: transparent;
    color: rgba(250,185,0,.7);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.perf-detail-btn:hover,
.perf-detail-btn.active {
    background: rgba(250,185,0,.12);
    color: var(--gold);
    border-color: var(--gold);
}

/* Hero KPIs above the chart */
.perf-hero-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.9rem;
    margin: 0.25rem 0 1.2rem;
    padding: 1rem 1.1rem;
    background: rgba(10, 14, 26, 0.55);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
}
.perf-hero-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}
.perf-hero-kpi-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--white-faint);
}
.perf-hero-kpi-value {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 400;
    line-height: 1.1;
    color: var(--gold);
    letter-spacing: -0.01em;
}
.perf-hero-kpi--pos .perf-hero-kpi-value { color: #34D399; }
.perf-hero-kpi--neg .perf-hero-kpi-value { color: #EF4444; }
.perf-hero-kpi[data-kind="dd"] .perf-hero-kpi-value { color: #EF4444; }

/* Legend (chart header) */
.perf-legend {
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.perf-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--white-dim);
    text-transform: uppercase;
}
.perf-legend-item i {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

/* Chart wrap */
.perf-chart-wrap {
    position: relative;
    width: 100%;
    min-height: 380px;
}
.perf-chart-wrap canvas {
    max-width: 100% !important;
    height: 100% !important;
}

/* Heatmap */
.perf-heatmap-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    padding-bottom: 0.25rem;
}
.perf-heatmap-table {
    border-collapse: separate;
    border-spacing: 4px;
    width: 100%;
    min-width: 540px;
    font-family: var(--font-mono);
}
.perf-heatmap-table thead th {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 600;
    padding: 0.3rem 0.2rem;
    text-align: center;
    background: transparent;
}
.perf-heatmap-year {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--white-dim);
    padding: 0.3rem 0.5rem;
    letter-spacing: 0.08em;
    text-align: right;
    font-weight: 600;
}
.perf-heatmap-cell {
    min-width: 58px;
    height: 36px;
    text-align: center;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(245, 245, 240, 0.04);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    cursor: default;
}
.perf-heatmap-cell:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(250, 185, 0, 0.4);
    z-index: 2;
    position: relative;
}
.perf-heatmap-cell--nodata {
    background: rgba(245, 245, 240, 0.03);
    color: var(--white-faint);
    cursor: default;
}
.perf-heatmap-cell--nodata:hover {
    transform: none;
    box-shadow: inset 0 0 0 1px rgba(245, 245, 240, 0.06);
}

.perf-heatmap-year-total {
    font-weight: 700 !important;
    min-width: 66px !important;
    box-shadow: inset 0 0 0 1px rgba(250, 185, 0, 0.22) !important;
    letter-spacing: 0.02em;
}
.perf-heatmap-year-total-head {
    color: var(--gold) !important;
    border-left: 1px solid rgba(250, 185, 0, 0.25);
    padding-left: 0.5rem !important;
}

.perf-heatmap-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
    margin-top: 1rem;
}

/* Placeholder (MeanReverting tab) */
.perf-placeholder-card {
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.perf-placeholder {
    text-align: center;
    padding: 2rem;
    max-width: 420px;
}
.perf-placeholder i {
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 1rem;
    opacity: 0.8;
}
.perf-placeholder h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--white);
    margin: 0 0 0.5rem;
}
.perf-placeholder p {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--white-dim);
    line-height: 1.55;
    margin: 0;
}

/* ==================================================================== */
/*  MeanReverting LITECOIN — trade list + extra meta                    */
/* ==================================================================== */
.perf-initial-capital,
.perf-trades-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--white-dim);
    text-transform: uppercase;
}

.perf-trades-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    border-radius: 8px;
    max-height: 520px;
    overflow-y: auto;
}

.perf-trades-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.84rem;
    color: var(--white);
    min-width: 860px;
}
.perf-trades-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--navy-mid);
    color: var(--white-dim);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.perf-trades-table tbody td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(245, 245, 240, 0.04);
    white-space: nowrap;
}
.perf-trades-table tbody tr:hover td {
    background: rgba(250, 185, 0, 0.04);
}
.perf-trades-table .mono { font-family: var(--font-mono); font-size: 0.8rem; }
.perf-trades-table .ta-right { text-align: right; }
.perf-trades-table .pnl-pos { color: #34D399; }
.perf-trades-table .pnl-neg { color: #EF4444; }

.perf-side {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.perf-side-long  { background: rgba(52, 211, 153, 0.15); color: #34D399; }
.perf-side-short { background: rgba(239, 68, 68, 0.15); color: #EF4444; }

.perf-src {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid rgba(245, 245, 240, 0.12);
    color: var(--white-dim);
}
.perf-src.src-hist { border-color: rgba(250, 185, 0, 0.35); color: var(--gold); }
.perf-src.src-bt   { border-color: rgba(1, 132, 205, 0.45); color: #0184CD; }

@media (max-width: 640px) {
    .perf-trades-table { font-size: 0.78rem; min-width: 780px; }
    .perf-trades-table thead th { padding: 0.5rem 0.55rem; }
    .perf-trades-table tbody td { padding: 0.45rem 0.55rem; }
}

.perf-empty {
    padding: 2rem;
    text-align: center;
    color: var(--white-dim);
    font-family: var(--font-body);
}

/* Responsive */
@media (max-width: 820px) {
    .perf-page { padding: 1.25rem; }
    .perf-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .perf-chart-wrap { min-height: 320px; }
    .perf-tab { padding: 0.5rem 0.9rem; font-size: 0.72rem; }
    .perf-stat-value { font-size: 1.35rem; }
    .perf-hero-kpi-value { font-size: 1.7rem; }
}

@media (max-width: 480px) {
    .perf-page { padding: 1rem 0.85rem 2rem; }
    .perf-stats-grid { grid-template-columns: 1fr; }
    .perf-chart-wrap { min-height: 260px; }
    .perf-heatmap-cell { min-width: 44px; height: 30px; font-size: 0.65rem; }
    .perf-heatmap-year-total { min-width: 54px !important; }
    .perf-heatmap-table { min-width: 500px; }
    .perf-heatmap-year { padding: 0.2rem 0.3rem; font-size: 0.65rem; }
    .perf-tab { padding: 0.42rem 0.75rem; font-size: 0.68rem; letter-spacing: 0.08em; }
    .perf-capital-input { padding: 0.35rem 0.55rem; }
    .perf-capital-input input { width: 80px; font-size: 0.85rem; }
    .perf-title { font-size: 1.5rem; }
    .perf-hero-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0.8rem 0.9rem;
        gap: 0.6rem;
    }
    .perf-hero-kpi-value { font-size: 1.4rem; }
    .perf-hero-kpi-label { font-size: 0.6rem; }
}

/* Radar — Alt-Side of the Moon section */
.altside-section { margin: 2.25rem 0 1.75rem; }
.altside-divider {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.85;
}
.altside-divider-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #FAB900; flex: 0 0 auto;
    box-shadow: 0 0 12px rgba(250, 185, 0, 0.5);
}
.altside-divider-line {
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245, 245, 240, 0.25), transparent);
}
.altside-divider-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.35em;
    color: #F5F5F099;
    text-transform: uppercase;
}
.altside-tile {
    display: grid;
    grid-template-columns: minmax(0, 560px);
    justify-content: end;
    gap: 1.5rem;
    align-items: center;
    width: 100%;
    text-align: right;
    padding: 2rem 2.25rem;
    min-height: 260px;
    border: 1px solid rgba(245, 245, 240, 0.08);
    border-radius: 18px;
    background:
        linear-gradient(rgba(10, 14, 26, 0.5), rgba(10, 14, 26, 0.5)),
        linear-gradient(270deg, rgba(10, 14, 26, 0.92) 0%, rgba(10, 14, 26, 0.55) 45%, rgba(10, 14, 26, 0) 100%),
        url("../img/altside_hero.webp") -120px center / cover no-repeat,
        #0A0E1A;
    cursor: pointer;
    color: inherit;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
    position: relative;
}
.altside-tile:hover {
    transform: translateY(-2px);
    border-color: rgba(250, 185, 0, 0.35);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.12);
}
.altside-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: -120px center;
    z-index: 0;
    pointer-events: none;
}
.altside-bg-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(rgba(10, 14, 26, 0.5), rgba(10, 14, 26, 0.5)),
        linear-gradient(270deg, rgba(10, 14, 26, 0.92) 0%, rgba(10, 14, 26, 0.55) 45%, rgba(10, 14, 26, 0) 100%);
}
.altside-tile > .altside-meta,
.altside-tile > .altside-content { position: relative; z-index: 2; }
.altside-meta {
    position: absolute;
    top: 0.9rem;
    left: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #F5F5F088;
    z-index: 2;
    pointer-events: none;
}
.altside-meta b {
    color: #F5F5F0CC;
    font-weight: 600;
    margin-left: 0.3em;
    text-transform: none;
    letter-spacing: 0;
}
.altside-meta-sep { opacity: 0.4; }
.altside-prism { display: none; }
.altside-prism-legacy {
    position: relative;
    aspect-ratio: 520 / 220;
    width: 100%;
    min-height: 180px;
}
.altside-prism svg { width: 100%; height: 100%; display: block; }
@keyframes altsideBeamPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}
@keyframes altsideRainbowFade {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}
@keyframes altsidePrismRotate {
    0% { transform: rotate(-1deg); }
    50% { transform: rotate(1deg); }
    100% { transform: rotate(-1deg); }
}
.altside-beam-in { animation: altsideBeamPulse 4s ease-in-out infinite; }
.altside-rainbow { animation: altsideRainbowFade 5s ease-in-out infinite; transform-origin: 260px 150px; }
.altside-prism-shape {
    transform-origin: 200px 113px;
    animation: altsidePrismRotate 9s ease-in-out infinite;
}
@keyframes altsideCandleDrift {
    0%   { transform: translateX(-40px) translateY(0); opacity: 0; }
    10%  { opacity: 0.9; }
    90%  { opacity: 0.9; }
    100% { transform: translateX(560px) translateY(0); opacity: 0; }
}
.altside-candle {
    transform: translateX(-40px);
    animation: altsideCandleDrift 12s linear infinite;
}
.altside-candle.c1 { animation-delay: 0s; }
.altside-candle.c2 { animation-delay: 4s; }
.altside-candle.c3 { animation-delay: 8s; }
.altside-content { display: flex; flex-direction: column; align-items: flex-end; gap: 0.75rem; min-width: 0; }
.altside-title {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.8rem, 3.4vw, 2.7rem);
    line-height: 1.05;
    margin: 0;
    color: #F5F5F0;
    font-weight: 400;
}
.altside-title-accent {
    background: linear-gradient(90deg, #EF4444, #FAB900, #34D399, #60A5FA, #8B5CF6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.altside-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: #F5F5F0AA;
    max-width: 460px;
    margin: 0;
    line-height: 1.45;
}
.altside-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 1.75rem;
    margin-top: 0.5rem;
    align-items: center;
}
.altside-stat { display: flex; flex-direction: column; align-items: flex-end; gap: 0.1rem; }
.altside-stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: #F5F5F077;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.altside-stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    color: #FAB900;
    font-weight: 600;
}
.altside-stat--cta {
    margin-left: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid rgba(250, 185, 0, 0.35);
    border-radius: 8px;
    color: #FAB900;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
}
.altside-tile:hover .altside-stat--cta {
    background: rgba(250, 185, 0, 0.08);
}
@media (max-width: 900px) {
    .altside-tile {
        grid-template-columns: 1fr;
        justify-content: stretch;
        padding: 1.25rem;
        min-height: 220px;
        background:
            linear-gradient(180deg, rgba(10, 14, 26, 0.92) 0%, rgba(10, 14, 26, 0.75) 60%, rgba(10, 14, 26, 0.35) 100%),
            url("../img/altside_hero.webp") center center / cover no-repeat,
            #0A0E1A;
    }
}

/* Alt-Side modal table */
.altside-card { padding: 1.5rem; }
.altside-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.altside-modal-title {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    color: #F5F5F0;
    font-weight: 400;
    margin: 0;
    line-height: 1.1;
}
.altside-modal-updated {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #F5F5F099;
}
.altside-table-wrap {
    max-height: 70vh;
    overflow: auto;
    border: 1px solid rgba(245, 245, 240, 0.08);
    border-radius: 10px;
}
.altside-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'DM Sans', sans-serif;
}
.altside-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #111827;
    color: #FAB900;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(245, 245, 240, 0.1);
    user-select: none;
}
.altside-table th.sortable { cursor: pointer; transition: color 0.2s ease; }
.altside-table th.sortable:hover { color: #F5F5F0; }
.altside-table th .sort-ind {
    display: inline-block;
    width: 10px;
    opacity: 0.7;
    font-size: 0.7rem;
}
.altside-table th.sort-asc .sort-ind::after  { content: "▲"; }
.altside-table th.sort-desc .sort-ind::after { content: "▼"; }
.altside-table tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgba(245, 245, 240, 0.04);
    font-size: 0.9rem;
    color: #F5F5F0DD;
}
.altside-table tbody tr:last-child td { border-bottom: none; }
.altside-coin {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: #F5F5F0;
    letter-spacing: 0.05em;
}
.altside-cell {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}
.altside-cell--long {
    color: #D1FAE5;
    background: rgba(52, 211, 153, 0.22);
    box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35);
}
.altside-cell--short {
    color: #FEE2E2;
    background: rgba(239, 68, 68, 0.22);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.4);
}
.altside-cell--neutral-l {
    color: #CBD5E1;
    background: rgba(148, 196, 178, 0.12);
    box-shadow: inset 0 0 0 1px rgba(148, 196, 178, 0.22);
}
.altside-cell--neutral-s {
    color: #E5D4D4;
    background: rgba(215, 160, 170, 0.12);
    box-shadow: inset 0 0 0 1px rgba(215, 160, 170, 0.22);
}
.altside-empty { text-align: center; color: #F5F5F099; padding: 2rem; }

/* Radar — Daily motivational hero */
.radar-hero {
    margin: 0 0 1.5rem 0;
    padding: 1.75rem 1.75rem 1.9rem;
    border-radius: 16px;
    background:
        radial-gradient(ellipse at top left, rgba(250, 185, 0, 0.08), transparent 60%),
        linear-gradient(135deg, rgba(17, 24, 39, 0.85), rgba(10, 14, 26, 0.85));
    border: 1px solid rgba(250, 185, 0, 0.18);
    position: relative;
    overflow: hidden;
}
.radar-hero::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, #FAB900 20%, #FAB900 80%, transparent);
    opacity: 0.6;
}
.radar-hero-inner {
    max-width: 980px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.radar-hero-headline {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    line-height: 1.05;
    letter-spacing: 0.01em;
    color: #FAB900;
    text-transform: uppercase;
    font-weight: 400;
}
.radar-hero-quote {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(1rem, 1.35vw, 1.15rem);
    line-height: 1.55;
    color: #F5F5F0DD;
    margin: 0;
    padding: 0;
    max-width: 780px;
    font-style: italic;
    border: none;
}
.radar-hero-quote::before { content: "“"; color: #FAB900AA; margin-right: 0.15em; }
.radar-hero-quote::after { content: "”"; color: #FAB900AA; margin-left: 0.15em; }
.radar-hero-author {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: #F5F5F099;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.radar-hero-author::before { content: "— "; color: #FAB900; }
.radar-hero.loading .radar-hero-headline,
.radar-hero.loading .radar-hero-quote,
.radar-hero.loading .radar-hero-author {
    opacity: 0.4;
}
@media (max-width: 720px) {
    .radar-hero { padding: 1.25rem 1.1rem 1.35rem; }
}

/* Altcoin Season — Top 100 list */
.as-top100-card { margin-top: 1.25rem; }

/* Standalone toggle button (outside .fg-timeframes wrapper) */
#asTop100Toggle {
    padding: 0.5rem 1.1rem;
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 104px;
    flex-shrink: 0;
}
#asTop100Toggle:hover {
    background: var(--gold);
    color: var(--navy);
}

.as-top100-wrap {
    margin-top: 1rem;
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid rgba(245, 245, 240, 0.08);
    border-radius: 10px;
    background: rgba(10, 14, 26, 0.35);
}
.as-top100-list { display: flex; flex-direction: column; }
.as-top100-row {
    display: grid;
    grid-template-columns: 48px 28px 56px 1fr 2fr 90px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid rgba(245, 245, 240, 0.05);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    color: #F5F5F0DD;
}
.as-top100-row:last-child { border-bottom: none; }
.as-top100-rank {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #F5F5F099;
}
.as-top100-logo { width: 24px; height: 24px; border-radius: 50%; }
.as-top100-sym { font-weight: 700; color: #F5F5F0; letter-spacing: 0.02em; }
.as-top100-name {
    color: #F5F5F0AA;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.as-top100-bar-wrap {
    position: relative;
    height: 10px;
    background: rgba(245, 245, 240, 0.06);
    border-radius: 5px;
    overflow: hidden;
}
.as-top100-bar {
    position: absolute; top: 0; left: 0; bottom: 0;
    border-radius: 5px;
    transition: width 0.3s ease;
}
.as-top100-pct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    text-align: right;
    font-weight: 600;
}
.as-top100-empty {
    padding: 2rem;
    text-align: center;
    color: #F5F5F099;
    font-family: 'DM Sans', sans-serif;
}
@media (max-width: 720px) {
    .as-top100-row {
        grid-template-columns: 40px 24px 52px 1fr 80px;
        gap: 0.5rem;
        font-size: 0.78rem;
    }
    .as-top100-name { display: none; }
}

@media (max-width: 640px) {
    .fg-card { padding: 1.1rem; }
    .fg-card-title { font-size: 1.05rem; margin-bottom: 1rem; }
    .fg-gauge-value { font-size: 2.5rem; }
    .fg-gauge-svg { max-width: 200px; }
    .fg-legend { gap: 0.6rem; font-size: 0.65rem; }
    .fg-chart-wrap { min-height: 280px; }
    .fg-chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .fg-hero-title { font-size: 1.6rem; }
    .fg-hero-sub { font-size: 0.88rem; }
    .fg-dashboard { gap: 1.25rem; }
    .fg-pill { font-size: 0.68rem; padding: 0.25rem 0.55rem; }
    .fg-summary-grid { gap: 1rem; }
    .fg-section { margin-top: 0.5rem; }
    .as-top100-card { margin-top: 0; }
    #asTop100Toggle { align-self: stretch; text-align: center; }
}

@media (max-width: 430px) {
    .fg-card { padding: 0.9rem; border-radius: 10px; }
    .fg-card-title { font-size: 1rem; }
    .fg-gauge-svg { max-width: 180px; }
    .fg-gauge-value { font-size: 2.2rem; }
    .fg-chart-wrap { min-height: 240px; }
    .fg-legend-item { font-size: 0.62rem; }
    .fg-tf { padding: 0.35rem 0.65rem; font-size: 0.65rem; letter-spacing: 1px; }
}

/* ══════════════════════════════════════════════
   Analisi di Mercato
   ══════════════════════════════════════════════ */
.analysis-page {
    padding: 2rem 2.25rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
}

.analysis-loading,
.analysis-empty {
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    padding: 2rem 0;
    text-align: center;
}

/* Card principale — stile simile al radar-hero */
.ma-card {
    background: linear-gradient(135deg, #0f1a2e 0%, #0a1628 100%);
    border: 1px solid rgba(250, 185, 0, 0.18);
    border-radius: 16px;
    overflow: hidden;
}

.ma-card-inner {
    padding: 2rem 2rem 1.5rem;
    position: relative;
}

.ma-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.85rem;
    line-height: 1.22;
    color: #F5F5F0;
    margin: 0 0 0.75rem;
}

.ma-desc {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #F5F5F0CC;
    margin: 0 0 1.25rem;
    max-width: 680px;
}

.ma-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: rgba(250, 185, 0, 0.6);
    letter-spacing: 0.06em;
}

/* Summary section */
.ma-summary {
    border-top: 1px solid rgba(250, 185, 0, 0.1);
    padding: 1.5rem 2rem 1.75rem;
    background: rgba(0, 0, 0, 0.15);
}

.ma-summary-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    margin: 0 0 1rem;
}

.ma-summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ma-summary-list li {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #F5F5F0CC;
    padding-left: 1.1rem;
    position: relative;
}

.ma-summary-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--gold);
    font-size: 0.75rem;
    top: 0.2em;
}

.ma-summary-list li strong {
    color: #F5F5F0;
    font-weight: 600;
}

@media (max-width: 640px) {
    .analysis-page { padding: 1.25rem 1rem 2rem; }
    .ma-card-inner { padding: 1.5rem 1.25rem 1.25rem; }
    .ma-title { font-size: 1.4rem; }
    .ma-summary { padding: 1.25rem 1.25rem 1.5rem; }
}

/* ══════════════════════════════════════════════════════════════
   AI Trading Page  (.ait-*)
   ══════════════════════════════════════════════════════════════ */

.ait-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0 0 2.5rem;
    min-height: 100%;
}

/* Hero banner */
.ait-hero {
    min-height: 160px;
    background: linear-gradient(135deg, #0A0E1A 0%, #0e1525 60%, #0A0E1A 100%);
    border-bottom: 1px solid rgba(250, 185, 0, 0.12);
}

.ait-hero-content {
    padding: 2rem 2rem 1.5rem;
}

.ait-title {
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
    font-weight: 400;
    color: var(--white);
    margin: 0 0 0.25rem;
    letter-spacing: 0.01em;
}

.ait-title-accent {
    color: var(--gold);
}

.ait-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: rgba(245, 245, 240, 0.55);
    margin: 0 0 1rem;
}

.ait-status-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: rgba(245, 245, 240, 0.65);
    flex-wrap: wrap;
}

.ait-status-sep {
    opacity: 0.3;
}

.ait-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #888;
}

.ait-dot-running {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: ait-pulse 2s ease-in-out infinite;
}

.ait-dot-stopped {
    background: var(--gold);
    box-shadow: 0 0 5px rgba(250,185,0,0.4);
}

.ait-dot-offline {
    background: var(--red);
    box-shadow: 0 0 5px rgba(239,68,68,0.4);
}

@keyframes ait-pulse {
    0%, 100% { box-shadow: 0 0 4px var(--green); opacity: 1; }
    50% { box-shadow: 0 0 10px var(--green); opacity: 0.75; }
}

/* Cards */
.ait-card {
    background: var(--navy-light);
    border: 1px solid rgba(250, 185, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
    margin: 0 1.25rem;
}

.ait-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(250, 185, 0, 0.08);
}

.ait-card-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* AI Summary */
.ait-summary-body {
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    border-left: 3px solid var(--gold);
    margin: 1rem 1.25rem 1.25rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    line-height: 1.75;
    color: rgba(245, 245, 240, 0.9);
    background: rgba(250, 185, 0, 0.04);
    border-radius: 0 8px 8px 0;
}

/* AI Reasoning */
.ait-toggle-btn {
    background: transparent;
    border: 1px solid rgba(250, 185, 0, 0.3);
    border-radius: 6px;
    color: var(--gold);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ait-toggle-btn:hover {
    background: rgba(250, 185, 0, 0.1);
    border-color: var(--gold);
}

.ait-thinking-body {
    padding: 1rem 1.25rem 1.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.65;
    color: rgba(245, 245, 240, 0.72);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow-y: auto;
    background: rgba(1, 132, 205, 0.04);
    border-top: 1px solid rgba(1, 132, 205, 0.1);
}

.ait-thinking-body::-webkit-scrollbar { width: 5px; }
.ait-thinking-body::-webkit-scrollbar-track { background: transparent; }
.ait-thinking-body::-webkit-scrollbar-thumb { background: rgba(250,185,0,0.2); border-radius: 3px; }

/* Segnali Operativi grid */
.ait-ops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
}

.ait-op-card {
    background: var(--navy-mid);
    border: 1px solid rgba(250, 185, 0, 0.08);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.ait-op-card:hover {
    border-color: rgba(250, 185, 0, 0.22);
}

.ait-op-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ait-op-symbol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.03em;
}

.ait-dir-pill {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

.ait-dir-long {
    background: rgba(52, 211, 153, 0.15);
    color: var(--green);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.ait-dir-short {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.ait-dir-close {
    background: rgba(248, 147, 25, 0.15);
    color: var(--orange);
    border: 1px solid rgba(248, 147, 25, 0.3);
}

.ait-dir-neutral {
    background: rgba(245, 245, 240, 0.08);
    color: rgba(245, 245, 240, 0.55);
    border: 1px solid rgba(245, 245, 240, 0.12);
}

.ait-op-body {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ait-op-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
}

.ait-op-row span:first-child {
    color: rgba(245, 245, 240, 0.45);
}

.ait-op-row span:last-child {
    color: var(--white);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
}

.ait-sl { color: var(--red) !important; }
.ait-tp { color: var(--green) !important; }

.ait-op-reasoning {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    line-height: 1.55;
    color: rgba(245, 245, 240, 0.55);
    font-style: italic;
}

/* Open Positions table */
.ait-table-wrap {
    overflow-x: auto;
    padding: 0 0 1rem;
}

.ait-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
}

.ait-table th {
    padding: 0.6rem 1.1rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gold);
    border-bottom: 1px solid rgba(250, 185, 0, 0.12);
    white-space: nowrap;
}

.ait-table td {
    padding: 0.6rem 1.1rem;
    color: rgba(245, 245, 240, 0.82);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    white-space: nowrap;
}

.ait-table tbody tr:hover td {
    background: rgba(250, 185, 0, 0.03);
}

.ait-pos-symbol {
    font-weight: 700;
    color: var(--white) !important;
}

.ait-side-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.05em;
}

/* Reuse dir classes for side badges */
.ait-side-badge.ait-dir-long { /* green — defined above */ }
.ait-side-badge.ait-dir-short { /* red — defined above */ }

/* PnL */
.pnl-pos { color: var(--green) !important; font-weight: 600; }
.pnl-neg { color: var(--red) !important; font-weight: 600; }

/* Misc */
.ait-empty-msg {
    color: rgba(245, 245, 240, 0.35);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem 1rem;
}

.ait-muted {
    color: rgba(245, 245, 240, 0.4);
    font-style: italic;
}

/* PnL chart section */
.ait-pnl-pills {
    display: flex;
    gap: 0.35rem;
}

.ait-pnl-kpis {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem 0;
    flex-wrap: wrap;
}

.ait-pnl-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ait-pnl-kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(245, 245, 240, 0.45);
    font-family: 'DM Sans', sans-serif;
}

.ait-pnl-kpi-value {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
}

.ait-pnl-chart-wrap {
    padding: 0.75rem 0.5rem 0.5rem;
    height: 260px;
    position: relative;
}

.ait-pnl-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Responsive */
@media (max-width: 768px) {
    .ait-hero-content { padding: 1.5rem 1.25rem 1.25rem; }
    .ait-title { font-size: 1.5rem; }
    .ait-card { margin: 0 0.75rem; }
    .ait-ops-grid { grid-template-columns: 1fr; padding: 1rem; }
    .ait-page { gap: 1rem; }
    .ait-pnl-kpis { gap: 1rem; }
    .ait-pnl-chart-wrap { height: 200px; }
}

/* ===========================
   THE STOPFATHER
   =========================== */

.sf-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem;
    min-height: calc(100vh - 4rem);
}

.sf-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sf-header-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--gold) 0%, #b8860b 100%);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: var(--navy);
}

.sf-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 400; margin: 0; }
.sf-title-accent { color: var(--gold); }
.sf-sub { color: var(--white-dim); font-size: 0.85rem; margin: 0.2rem 0 0; }

/* Exchange Dashboard */
.sf-dashboard { background: var(--navy-light); border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border-color); }

.sf-section-title {
    font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 2px;
    text-transform: uppercase; color: var(--gold); margin-bottom: 0.75rem;
    display: flex; align-items: center; gap: 0.5rem;
}

.sf-exchanges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }

.sf-exchange-btn {
    background: var(--navy-mid); border: 1px solid var(--border-color);
    border-radius: 10px; padding: 1rem;
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem;
    cursor: pointer; transition: all var(--transition-fast);
    text-align: left;
}
.sf-exchange-btn:hover { border-color: var(--gold); background: var(--navy-hover, rgba(218,165,32,0.06)); }

.sf-exch-dot { width: 8px; height: 8px; border-radius: 50%; display: block; }
.sf-exch-name { font-weight: 600; color: var(--white); font-size: 0.95rem; }
.sf-exch-label { font-size: 0.75rem; color: var(--white-dim); }
.sf-key-status { font-size: 0.7rem; font-family: var(--font-mono); margin-top: 0.2rem; }

/* Exchange Panel */
.sf-exchange-panel { background: var(--navy-light); border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border-color); }

.sf-exchange-nav {
    display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem;
    padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-color);
}

.sf-back-btn {
    background: transparent; border: 1px solid var(--border-color); color: var(--white-dim);
    border-radius: 6px; padding: 0.4rem 0.75rem; cursor: pointer; font-size: 0.8rem;
    transition: all var(--transition-fast);
}
.sf-back-btn:hover { border-color: var(--gold); color: var(--gold); }

.sf-exchange-title {
    flex: 1; font-weight: 600; color: var(--white);
    display: flex; align-items: center; gap: 0.5rem;
}

.sf-exch-indicator { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.sf-key-btn {
    background: rgba(218, 165, 32, 0.1); border: 1px solid rgba(218, 165, 32, 0.3);
    color: var(--gold); border-radius: 6px; padding: 0.4rem 0.75rem;
    cursor: pointer; font-size: 0.8rem; transition: all var(--transition-fast);
}
.sf-key-btn:hover { background: rgba(218, 165, 32, 0.2); }

.sf-market-btns { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.sf-market-btn {
    background: var(--navy-mid); border: 1px solid var(--border-color);
    color: var(--white-dim); border-radius: 8px; padding: 0.5rem 1rem;
    cursor: pointer; font-size: 0.85rem; transition: all var(--transition-fast);
    display: flex; align-items: center; gap: 0.4rem;
}
.sf-market-btn.active { background: rgba(218, 165, 32, 0.12); border-color: var(--gold); color: var(--gold); }
.sf-market-btn:hover:not(.active) { border-color: var(--border-color-hover, rgba(255,255,255,0.2)); color: var(--white); }

.sf-positions-wrap { min-height: 100px; }
.sf-loading { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 2rem; color: var(--white-dim); font-size: 0.85rem; }
.sf-empty { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2.5rem; color: rgba(245,245,240,0.3); font-size: 0.85rem; text-align: center; }
.sf-empty i { font-size: 2rem; }

.sf-table-wrap { overflow-x: auto; }

.sf-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.sf-table th { text-align: left; padding: 0.6rem 0.75rem; font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.sf-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04)); color: var(--white-dim); white-space: nowrap; }
.sf-table tr:last-child td { border-bottom: none; }
.sf-table tr:hover td { background: rgba(255,255,255,0.02); }

.sf-symbol { color: var(--white); font-weight: 600; font-family: var(--font-mono); }

.sf-side-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; }
.sf-side-long { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.sf-side-short { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.sf-pnl-pos { color: #10b981; font-weight: 600; }
.sf-pnl-neg { color: #ef4444; font-weight: 600; }

.sf-protect-btn {
    background: rgba(218,165,32,0.1); border: 1px solid rgba(218,165,32,0.25);
    color: var(--gold); border-radius: 5px; padding: 0.3rem 0.6rem;
    cursor: pointer; font-size: 0.8rem; transition: all var(--transition-fast);
}
.sf-protect-btn:hover { background: rgba(218,165,32,0.25); }

/* Strategies Panel */
.sf-strategies-panel { background: var(--navy-light); border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border-color); }

.sf-refresh-btn {
    background: none; border: none; color: var(--gold); cursor: pointer;
    font-size: 0.85rem; margin-left: auto; transition: transform 0.3s;
}
.sf-refresh-btn:hover { transform: rotate(90deg); }

.sf-strategies-empty { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1.5rem; color: rgba(245,245,240,0.25); font-size: 0.85rem; text-align: center; }
.sf-strategies-empty i { font-size: 1.8rem; }

.sf-strategies-list { display: flex; flex-direction: column; gap: 0.6rem; }

.sf-strat-card {
    background: var(--navy-mid); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 0.85rem; display: flex; align-items: flex-start;
    gap: 0.75rem;
}

.sf-strat-info { flex: 1; }
.sf-strat-type { font-size: 0.8rem; color: var(--gold); font-weight: 600; margin-bottom: 0.3rem; }
.sf-strat-pos { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.25rem; }
.sf-strat-exch { font-size: 0.7rem; color: var(--white-dim); font-family: var(--font-mono); }
.sf-strat-detail { font-size: 0.75rem; color: var(--white-dim); font-family: var(--font-mono); }

.sf-cancel-btn {
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
    color: #ef4444; border-radius: 5px; padding: 0.35rem 0.6rem;
    cursor: pointer; font-size: 0.8rem; transition: all var(--transition-fast);
    flex-shrink: 0;
}
.sf-cancel-btn:hover { background: rgba(239,68,68,0.25); }

/* Modals */
.sf-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 500;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}

.sf-modal {
    background: var(--navy-mid); border: 1px solid var(--border-color);
    border-radius: 14px; width: 90%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.25s ease;
}

.sf-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color);
}
.sf-modal-header h3 { font-family: var(--font-display); font-weight: 400; margin: 0; font-size: 1.1rem; }

.sf-modal-close {
    background: none; border: none; color: var(--white-dim);
    cursor: pointer; font-size: 1rem; transition: color var(--transition-fast);
}
.sf-modal-close:hover { color: var(--white); }

.sf-modal-body { padding: 1.25rem 1.5rem 1.5rem; }

/* Protection type options */
.sf-protect-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.sf-protect-option {
    background: var(--navy); border: 1px solid var(--border-color);
    border-radius: 10px; padding: 1.25rem; cursor: pointer;
    text-align: center; transition: all var(--transition-fast);
}
.sf-protect-option:hover { border-color: var(--gold); background: rgba(218,165,32,0.06); }
.sf-po-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.sf-po-title { font-weight: 600; color: var(--white); margin-bottom: 0.3rem; }
.sf-po-desc { font-size: 0.75rem; color: var(--white-dim); }

/* Form elements */
.sf-form-group { margin-bottom: 1rem; }
.sf-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.sf-label { display: block; font-size: 0.78rem; color: var(--white-dim); margin-bottom: 0.35rem; font-family: var(--font-mono); letter-spacing: 0.5px; }

.sf-input {
    width: 100%; background: var(--navy); border: 1px solid var(--border-color);
    color: var(--white); border-radius: 6px; padding: 0.6rem 0.75rem;
    font-family: var(--font-mono); font-size: 0.85rem;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}
.sf-input:focus { outline: none; border-color: var(--gold); }
.sf-input option { background: var(--navy-mid); }

.sf-modal-actions { display: flex; gap: 0.5rem; margin-top: 1.25rem; }

.sf-btn {
    flex: 1; padding: 0.65rem 1rem; border-radius: 6px; border: none;
    cursor: pointer; font-family: var(--font-mono); font-size: 0.78rem;
    letter-spacing: 1px; text-transform: uppercase; font-weight: 600;
    transition: all var(--transition-fast); display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.sf-btn-primary { background: var(--gold); color: var(--navy); }
.sf-btn-primary:hover { background: #ffc933; }
.sf-btn-ghost { background: transparent; border: 1px solid var(--border-color); color: var(--white-dim); }
.sf-btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.sf-btn-danger { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #ef4444; flex: none; }
.sf-btn-danger:hover { background: rgba(239,68,68,0.3); }

.sf-feedback { margin-top: 0.75rem; padding: 0.5rem 0.75rem; border-radius: 6px; font-size: 0.8rem; }
.sf-fb-info { background: rgba(59,130,246,0.1); color: #60a5fa; }
.sf-fb-success { background: rgba(16,185,129,0.1); color: #10b981; }
.sf-fb-error { background: rgba(239,68,68,0.1); color: #ef4444; }

/* User avatar image */
.user-avatar-img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

@media (max-width: 768px) {
    .sf-exchanges { grid-template-columns: 1fr; }
    .sf-protect-options { grid-template-columns: 1fr; }
    .sf-form-row { grid-template-columns: 1fr; }
    .sf-modal { width: 95%; }
}

/* ================================================================
   PORTFOLIO PAGE
   ================================================================ */

.ptf-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0 0 3rem;
    min-height: 100%;
}

/* Header — no horiz padding (content-wrapper already provides 2rem) */
.ptf-header {
    padding: 1.5rem 0 1.25rem;
    background: linear-gradient(135deg, #0A0E1A 0%, #0e1525 60%, #0A0E1A 100%);
    border-bottom: 1px solid rgba(250, 185, 0, 0.12);
    margin: -2rem -2rem 0;
    padding-left: 2rem;
    padding-right: 2rem;
}
.ptf-title {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    font-weight: 400;
    color: #F5F5F0;
    margin: 0 0 0.25rem;
    line-height: 1.1;
}
.ptf-title-accent { color: #FAB900; }
.ptf-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: rgba(245, 245, 240, 0.55);
    margin: 0;
}

/* KPIs */
.ptf-kpis {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.ptf-kpi {
    flex: 1;
    min-width: 130px;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.7), rgba(10, 14, 26, 0.7));
    border: 1px solid rgba(245, 245, 240, 0.08);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}
.ptf-kpi-label {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(245, 245, 240, 0.5);
    margin-bottom: 0.35rem;
}
.ptf-kpi-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: #F5F5F0;
}
.ptf-pos { color: #34D399 !important; }
.ptf-neg { color: #EF4444 !important; }

/* Main layout: two columns */
.ptf-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1.25rem;
    align-items: start;
}
.ptf-left, .ptf-right {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Card */
.ptf-card {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.6), rgba(10, 14, 26, 0.6));
    border: 1px solid rgba(245, 245, 240, 0.08);
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
}
.ptf-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.ptf-card-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #FAB900;
    font-weight: 600;
    margin: 0;
}
.ptf-card-title i { margin-right: 0.4rem; }

/* Add form */
.ptf-add-form { display: flex; flex-direction: column; gap: 0.75rem; }

.ptf-search-wrap { position: relative; }
.ptf-input {
    width: 100%;
    background: rgba(245, 245, 240, 0.05);
    border: 1px solid rgba(245, 245, 240, 0.12);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    color: #F5F5F0;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.ptf-input:focus { border-color: rgba(250, 185, 0, 0.5); }
.ptf-input::placeholder { color: rgba(245, 245, 240, 0.3); }

.ptf-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #111827;
    border: 1px solid rgba(245, 245, 240, 0.12);
    border-radius: 8px;
    z-index: 50;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.ptf-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(245,245,240,0.05);
    transition: background 0.15s;
}
.ptf-dropdown-item:last-child { border-bottom: none; }
.ptf-dropdown-item:hover { background: rgba(250,185,0,0.08); }
.ptf-dropdown-sym {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    color: #FAB900;
    min-width: 54px;
}
.ptf-dropdown-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.84rem;
    color: #F5F5F0;
    flex: 1;
}
.ptf-dropdown-type {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.ptf-type-crypto    { background: rgba(96,165,250,0.15); color: #60A5FA; }
.ptf-type-commodity { background: rgba(250,185,0,0.15);  color: #FAB900; }
.ptf-type-index     { background: rgba(52,211,153,0.15); color: #34D399; }
.ptf-type-stock     { background: rgba(167,139,250,0.15);color: #A78BFA; }

.ptf-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.ptf-form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.ptf-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: rgba(245, 245, 240, 0.55);
    letter-spacing: 0.06em;
}
.ptf-form-feedback {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    min-height: 1.2em;
}
.ptf-feedback-ok    { color: #34D399; }
.ptf-feedback-error { color: #EF4444; }

.ptf-btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: rgba(250, 185, 0, 0.12);
    border: 1px solid rgba(250, 185, 0, 0.35);
    border-radius: 8px;
    color: #FAB900;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.ptf-btn-add:hover:not(:disabled) { background: rgba(250, 185, 0, 0.2); border-color: #FAB900; }
.ptf-btn-add:disabled { opacity: 0.5; cursor: not-allowed; }

/* Table */
.ptf-table-wrap { overflow-x: auto; }
.ptf-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.84rem;
}
.ptf-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(245,245,240,0.45);
    border-bottom: 1px solid rgba(245,245,240,0.06);
    white-space: nowrap;
}
.ptf-table td {
    padding: 0.65rem 0.6rem;
    color: rgba(245, 245, 240, 0.85);
    border-bottom: 1px solid rgba(245, 245, 240, 0.04);
    vertical-align: middle;
}
.ptf-table tr:last-child td { border-bottom: none; }
.ptf-table tr:hover td { background: rgba(245,245,240,0.02); }
.ptf-mono { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; }

.ptf-asset-cell { display: flex; align-items: center; gap: 0.65rem; }
.ptf-asset-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ptf-asset-sym {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    color: #F5F5F0;
}
.ptf-asset-name {
    font-size: 0.74rem;
    color: rgba(245,245,240,0.45);
    margin-top: 1px;
}

.ptf-del-btn {
    background: none;
    border: none;
    color: rgba(239, 68, 68, 0.5);
    cursor: pointer;
    padding: 0.25rem 0.35rem;
    border-radius: 5px;
    font-size: 0.8rem;
    transition: color 0.15s, background 0.15s;
}
.ptf-del-btn:hover { color: #EF4444; background: rgba(239,68,68,0.1); }

.ptf-refresh-btn {
    background: none;
    border: 1px solid rgba(245,245,240,0.1);
    border-radius: 6px;
    color: rgba(245,245,240,0.45);
    cursor: pointer;
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
    transition: color 0.15s, border-color 0.15s;
}
.ptf-refresh-btn:hover { color: #FAB900; border-color: rgba(250,185,0,0.3); }

.ptf-loading {
    text-align: center;
    padding: 2rem;
    color: rgba(245,245,240,0.35);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
}

/* Empty state */
.ptf-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: rgba(245,245,240,0.4);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    line-height: 1.6;
}
.ptf-empty-icon {
    font-size: 2.5rem;
    color: rgba(250,185,0,0.25);
    display: block;
    margin-bottom: 0.75rem;
}
.ptf-empty-sub { font-size: 0.8rem; color: rgba(245,245,240,0.25); margin: 0; }

/* cAImi trigger button */
.ptf-caimi-trigger {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(17,24,39,0.6), rgba(10,14,26,0.6));
    border: 1px solid rgba(250, 185, 0, 0.2);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.ptf-caimi-trigger:hover {
    border-color: rgba(250,185,0,0.5);
    background: linear-gradient(135deg, rgba(250,185,0,0.06), rgba(10,14,26,0.6));
}
.ptf-caimi-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }
.ptf-caimi-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.ptf-caimi-text strong {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: #F5F5F0;
}
.ptf-caimi-text span {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.78rem;
    color: rgba(245,245,240,0.45);
}
.ptf-caimi-arrow { color: rgba(250,185,0,0.5); font-size: 0.85rem; }
.ptf-ai-blue { color: #60A5FA; font-weight: 700; }

/* Doughnut */
.ptf-donut-card { position: relative; }
.ptf-donut-wrap {
    position: relative;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ptf-donut-wrap canvas { max-height: 280px; }
.ptf-donut-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -56%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: #F5F5F0;
    pointer-events: none;
    white-space: nowrap;
}

/* Pills (reuse corr-pill) */
.ptf-pills { display: flex; gap: 0.4rem; }

/* Line chart */
.ptf-line-wrap { height: 260px; }
.ptf-line-wrap canvas { width: 100% !important; height: 100% !important; }

/* cAImi Modal */
.ptf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 20, 0.75);
    backdrop-filter: blur(4px);
    z-index: 900;
}
.ptf-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(700px, 94vw);
    max-height: 85vh;
    background: linear-gradient(160deg, #0e1525 0%, #0A0E1A 100%);
    border: 1px solid rgba(250, 185, 0, 0.2);
    border-radius: 18px;
    z-index: 901;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7);
}
.ptf-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(245, 245, 240, 0.06);
    flex-shrink: 0;
}
.ptf-modal-logo {
    width: 44px; height: 44px;
    object-fit: contain;
    border-radius: 10px;
}
.ptf-modal-title {
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #F5F5F0;
    margin: 0;
}
.ptf-modal-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    color: rgba(245,245,240,0.4);
    margin: 0.15rem 0 0;
}
.ptf-modal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(245,245,240,0.4);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: color 0.15s;
    flex-shrink: 0;
}
.ptf-modal-close:hover { color: #F5F5F0; }

.ptf-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}
.ptf-modal-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
    padding: 1rem 0;
}
.ptf-modal-intro p {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: rgba(245,245,240,0.65);
    line-height: 1.6;
    max-width: 480px;
    margin: 0;
}
.ptf-btn-analyze {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.75rem 1.75rem;
    background: rgba(250,185,0,0.12);
    border: 1px solid rgba(250,185,0,0.4);
    border-radius: 10px;
    color: #FAB900;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.ptf-btn-analyze:hover { background: rgba(250,185,0,0.2); border-color: #FAB900; }

.ptf-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2.5rem 1rem;
    text-align: center;
}
.ptf-modal-loading p {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: rgba(245,245,240,0.65);
    margin: 0;
}
.ptf-spinner { font-size: 2rem; color: #FAB900; }

.ptf-modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    color: #EF4444;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
}
.ptf-modal-error i { font-size: 2rem; }

/* Analysis result */
.ptf-modal-result { display: flex; flex-direction: column; gap: 1rem; }
.ptf-btn-rerun {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(245,245,240,0.05);
    border: 1px solid rgba(245,245,240,0.12);
    border-radius: 7px;
    color: rgba(245,245,240,0.6);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.ptf-btn-rerun:hover { color: #FAB900; border-color: rgba(250,185,0,0.3); }

.ptf-analysis-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    line-height: 1.7;
    color: rgba(245,245,240,0.85);
}
.ptf-analysis-text p { margin: 0.5rem 0; }
.ptf-analysis-h {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #FAB900;
    font-weight: 600;
    margin: 1.2rem 0 0.4rem;
}
.ptf-analysis-item {
    display: flex;
    gap: 0.5rem;
    margin: 0.35rem 0;
}
.ptf-item-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #FAB900;
    flex-shrink: 0;
    margin-top: 0.05rem;
}
.ptf-analysis-bullet { margin: 0.25rem 0; padding-left: 0.5rem; }

/* Responsive */
@media (max-width: 1024px) {
    .ptf-layout { grid-template-columns: 1fr; }
    .ptf-header { padding-top: 1.25rem; padding-bottom: 1rem; }
}

@media (max-width: 600px) {
    .ptf-kpi { min-width: calc(50% - 0.3rem); padding: 0.75rem 1rem; }
    .ptf-layout { gap: 0.85rem; }
    .ptf-card { padding: 1rem 0.9rem; }
    .ptf-form-row { grid-template-columns: 1fr; }
    .ptf-donut-wrap { height: 220px; }
    .ptf-line-wrap { height: 200px; }
    .ptf-modal { border-radius: 14px 14px 0 0; top: auto; bottom: 0; left: 0; right: 0; transform: none; width: 100%; max-height: 90vh; }
}

/* =============================================================================
   FED Calendar — Card + Modal
   ============================================================================= */

.fed-section {
    margin-top: 1.5rem;
}

/* Divider (mirrors altside-divider) */
.fed-divider {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.85;
}
.fed-divider-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #FAB900; flex: 0 0 auto;
    box-shadow: 0 0 12px rgba(250,185,0,0.5);
}
.fed-divider-line {
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245,245,240,0.25), transparent);
}
.fed-divider-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.35em;
    color: #F5F5F099;
    text-transform: uppercase;
}

/* Card button */
.fed-card {
    all: unset;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
    background: var(--navy-light);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.fed-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #FAB900 0%, rgba(250,185,0,0.3) 100%);
    border-radius: 16px 0 0 16px;
}
.fed-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(250,185,0,0.06) 0%, transparent 65%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.fed-card:hover {
    transform: translateY(-3px);
    border-color: rgba(250,185,0,0.35);
    background: var(--navy-mid);
}
.fed-card:hover::after { opacity: 1; }
.fed-card:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Left column */
.fed-card-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.fed-card-icon {
    font-size: 1.6rem;
    color: rgba(250,185,0,0.7);
    flex: 0 0 auto;
    line-height: 1;
}
.fed-card-left-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.fed-card-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: rgba(245,245,240,0.45);
    text-transform: uppercase;
}
.fed-card-date {
    font-family: 'Instrument Serif', serif;
    font-size: 1.15rem;
    color: #F5F5F0;
    line-height: 1.2;
}
.fed-card-countdown {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #FAB900;
    font-weight: 600;
}

/* Center column */
.fed-card-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    text-align: center;
    padding: 0.5rem 1.25rem;
    border-left: 1px solid rgba(245,245,240,0.08);
    border-right: 1px solid rgba(245,245,240,0.08);
}
.fed-card-rate-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: rgba(245,245,240,0.4);
    text-transform: uppercase;
}
.fed-card-rate {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #FAB900;
    letter-spacing: 0.03em;
    line-height: 1;
}
.fed-card-rate-sub {
    font-size: 0.68rem;
    color: rgba(245,245,240,0.35);
}

/* Right column */
.fed-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
}
.fed-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    padding: 0.25rem 0.6rem;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
}
.fed-badge--projections {
    background: rgba(250,185,0,0.12);
    border: 1px solid rgba(250,185,0,0.35);
    color: #FAB900;
}
.fed-card-foot {
    font-size: 0.8rem;
    color: rgba(245,245,240,0.5);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s ease;
}
.fed-card:hover .fed-card-foot {
    color: #FAB900;
}
.fed-card:hover .fed-card-foot i {
    transform: translateX(3px);
}
.fed-card-foot i {
    transition: transform 0.2s ease;
    font-size: 0.7rem;
}

/* Modal */
.detail-content--fed {
    max-width: 680px;
    width: 100%;
}
.fed-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 0 1.25rem 0;
    border-bottom: 1px solid rgba(245,245,240,0.08);
    margin-bottom: 1.25rem;
}
.fed-modal-title {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.fed-modal-icon {
    font-size: 1.4rem;
    color: rgba(250,185,0,0.65);
}
.fed-modal-h {
    font-family: 'Instrument Serif', serif;
    font-size: 1.3rem;
    color: #F5F5F0;
    margin: 0 0 0.2rem 0;
}
.fed-modal-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: rgba(245,245,240,0.4);
    margin: 0;
}
.fed-modal-rate-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    flex: 0 0 auto;
}
.fed-modal-rate-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: rgba(245,245,240,0.4);
    text-transform: uppercase;
}
.fed-modal-rate-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    font-weight: 700;
    color: #FAB900;
    letter-spacing: 0.03em;
    line-height: 1;
}
.fed-modal-rate-desc {
    font-size: 0.65rem;
    color: rgba(245,245,240,0.3);
}

/* Timeline */
.fed-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.fed-timeline-loading {
    text-align: center;
    color: rgba(245,245,240,0.4);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 2rem 0;
}
.fed-tl-row {
    display: grid;
    grid-template-columns: 1.8rem 24px 1fr;
    gap: 0 0.75rem;
    align-items: stretch;
    position: relative;
    padding: 0.85rem 0;
    opacity: 0.55;
    transition: opacity 0.2s ease;
}
.fed-tl-row--next,
.fed-tl-row--ongoing {
    opacity: 1;
}
.fed-tl-row--past {
    opacity: 0.42;
}

.fed-tl-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: rgba(245,245,240,0.3);
    text-align: right;
    line-height: 1;
    padding-top: 4px;
}
.fed-tl-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.fed-tl-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(245,245,240,0.2);
    border: 2px solid rgba(245,245,240,0.15);
    flex: 0 0 auto;
    margin-top: 3px;
    transition: background 0.2s, border-color 0.2s;
}
.fed-tl-row--next .fed-tl-dot {
    background: #FAB900;
    border-color: #FAB900;
    box-shadow: 0 0 10px rgba(250,185,0,0.6);
}
.fed-tl-row--ongoing .fed-tl-dot {
    background: #34D399;
    border-color: #34D399;
    box-shadow: 0 0 10px rgba(52,211,153,0.5);
}
.fed-tl-row--past .fed-tl-dot {
    background: rgba(245,245,240,0.12);
    border-color: rgba(245,245,240,0.1);
}
.fed-tl-line {
    flex: 1;
    width: 1px;
    background: rgba(245,245,240,0.08);
    margin-top: 4px;
}
.fed-tl-row:last-child .fed-tl-line { display: none; }

.fed-tl-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.5rem;
}
.fed-tl-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.fed-tl-next-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.15em;
    color: #FAB900;
    background: rgba(250,185,0,0.1);
    border: 1px solid rgba(250,185,0,0.25);
    padding: 0.15rem 0.45rem;
    border-radius: 100px;
    text-transform: uppercase;
}
.fed-tl-date {
    font-size: 0.9rem;
    color: #F5F5F0;
    font-weight: 500;
}
.fed-tl-badges {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}
.fed-tl-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    padding: 0.15rem 0.45rem;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
}
.fed-tl-badge--dotplot {
    background: rgba(139,92,246,0.15);
    border: 1px solid rgba(139,92,246,0.3);
    color: #a78bfa;
}
.fed-tl-badge--hold {
    background: rgba(245,245,240,0.08);
    border: 1px solid rgba(245,245,240,0.15);
    color: rgba(245,245,240,0.55);
}
.fed-tl-badge--cut {
    background: rgba(52,211,153,0.1);
    border: 1px solid rgba(52,211,153,0.25);
    color: #34D399;
}
.fed-tl-badge--hike {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    color: #EF4444;
}
.fed-tl-countdown {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #FAB900;
    font-weight: 600;
    margin-left: auto;
}
.fed-tl-countdown--live {
    color: #34D399;
}
.fed-tl-rate {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: rgba(245,245,240,0.4);
}

/* Footer */
.fed-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(245,245,240,0.06);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    color: rgba(245,245,240,0.28);
}

/* Responsive */
@media (max-width: 600px) {
    .fed-card {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .fed-card-center {
        align-items: flex-start;
        text-align: left;
        padding: 0.75rem 0;
        border-left: none;
        border-right: none;
        border-top: 1px solid rgba(245,245,240,0.08);
        border-bottom: 1px solid rgba(245,245,240,0.08);
    }
    .fed-card-right {
        align-items: flex-start;
        flex-direction: row;
        justify-content: space-between;
    }
    .fed-modal-head {
        flex-direction: column;
        gap: 0.75rem;
    }
    .fed-modal-rate-box { align-items: flex-start; }
    .fed-tl-countdown { margin-left: 0; width: 100%; }
}

/* =============================================================================
   Markets — Tile section wrapper
   ============================================================================= */

.mkt-tile-section {
    margin-top: 1.5rem;
}

/* Mini icon badge inside tile-label (mirrors .btc-ic) */
.mkt-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    margin-right: 0.3rem;
    vertical-align: -3px;
    color: var(--navy);
}
.mkt-ic--spx  { background: #60A5FA; }
.mkt-ic--gold { background: #FAB900; letter-spacing: -0.02em; }
.mkt-ic--econ { background: #8B5CF6; font-size: 0.55rem; color: #fff; min-width: 18px; }

/* S&P 500 tile */
.tile--spx { position: relative; }
.tile--spx::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 15% 10%, rgba(96,165,250,0.12), transparent 55%),
        radial-gradient(ellipse 60% 50% at 90% 95%, rgba(59,130,246,0.06), transparent 55%);
    pointer-events: none;
    z-index: 0;
}
.tile--spx > * { position: relative; z-index: 1; }
.tile--spx:hover { border-color: rgba(96,165,250,0.4); }
.tile--spx::after { background: radial-gradient(circle at 50% 120%, rgba(96,165,250,0.1) 0%, transparent 55%); }

/* Gold tile */
.tile--gold { position: relative; }
.tile--gold::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 15% 10%, rgba(250,185,0,0.10), transparent 55%),
        radial-gradient(ellipse 60% 50% at 90% 95%, rgba(217,119,6,0.06), transparent 55%);
    pointer-events: none;
    z-index: 0;
}
.tile--gold > * { position: relative; z-index: 1; }
.tile--gold:hover { border-color: rgba(250,185,0,0.4); }

/* Economic Indicators tile */
.tile--econ { position: relative; }
.tile--econ::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 15% 10%, rgba(139,92,246,0.12), transparent 55%),
        radial-gradient(ellipse 60% 50% at 90% 95%, rgba(124,58,237,0.06), transparent 55%);
    pointer-events: none;
    z-index: 0;
}
.tile--econ > * { position: relative; z-index: 1; }
.tile--econ:hover { border-color: rgba(139,92,246,0.4); }
.tile--econ::after { background: radial-gradient(circle at 50% 120%, rgba(139,92,246,0.1) 0%, transparent 55%); }

/* MACRO badge */
.tile-badge--macro {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    padding: 0.22rem 0.55rem;
    border-radius: 4px;
    background: rgba(139,92,246,0.15);
    border: 1px solid rgba(139,92,246,0.3);
    color: #a78bfa;
    text-transform: uppercase;
}

/* Econ tile body */
.tile-body--econ {
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
}
.econ-tile-rate-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}
.econ-tile-rate {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 5.5vw, 2.7rem);
    line-height: 1;
    color: #a78bfa;
    letter-spacing: -0.5px;
    text-align: center;
}
.econ-tile-rate-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(245,245,240,0.35);
    text-align: center;
}
.econ-tile-mini-row {
    display: flex;
    gap: 0.9rem;
    justify-content: center;
}
.econ-tile-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.econ-tile-mini-label {
    font-family: var(--font-mono);
    font-size: 0.54rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(245,245,240,0.3);
}
.econ-tile-mini-val {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(167,139,250,0.85);
}

/* =============================================================================
   Markets — NOT JUST THE TOKEN, COMMODITIES, ECONOMIC INDICATORS
   ============================================================================= */

/* Card variants */
.mkt-card-icon { color: rgba(96,165,250,0.7); }
.cmt-icon      { color: rgba(250,185,0,0.75); }
.econ-icon     { color: rgba(139,92,246,0.7); }

.mkt-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #F5F5F0;
    letter-spacing: 0.02em;
}
.mkt-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: #34D399;
}
.mkt-change.down { color: #EF4444; }

.mkt-sparkline-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    border-left: 1px solid rgba(245,245,240,0.08);
    border-right: 1px solid rgba(245,245,240,0.08);
}
.mkt-sparkline {
    width: 100%;
    max-width: 240px;
    height: 50px;
}

/* Econ hero */
.econ-hero-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: #8B5CF6;
    letter-spacing: 0.02em;
    line-height: 1;
}
.econ-badges-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    border-left: 1px solid rgba(245,245,240,0.08);
    border-right: 1px solid rgba(245,245,240,0.08);
}
.econ-mini-badges {
    display: flex;
    gap: 1rem;
}
.econ-mini-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}
.econ-mini-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    color: rgba(245,245,240,0.4);
    text-transform: uppercase;
}
.econ-mini-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    color: #F5F5F0;
}
.econ-badge {
    background: rgba(139,92,246,0.12);
    border: 1px solid rgba(139,92,246,0.3);
    color: #a78bfa;
}

/* Markets Modal */
.detail-content--markets {
    max-width: 900px;
    width: 100%;
}
.detail-content--econ {
    max-width: 900px;
    width: 100%;
}
.mkt-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(245,245,240,0.08);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.mkt-modal-title {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.mkt-modal-icon { font-size: 1.3rem; color: rgba(96,165,250,0.65); }
.cmt-modal-icon { color: rgba(250,185,0,0.65); }
.econ-modal-icon { color: rgba(139,92,246,0.65); }

/* Timeframe buttons */
.mkt-modal-tf {
    display: flex;
    gap: 0.3rem;
}
.mkt-tf {
    all: unset;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    border: 1px solid rgba(245,245,240,0.12);
    color: rgba(245,245,240,0.45);
    cursor: pointer;
    transition: all 0.2s;
}
.mkt-tf:hover { border-color: rgba(250,185,0,0.35); color: #FAB900; }
.mkt-tf.active {
    background: rgba(250,185,0,0.1);
    border-color: rgba(250,185,0,0.4);
    color: #FAB900;
}

/* Indices/Commodities grid */
.mkt-indices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.mkt-index-panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(245,245,240,0.07);
    border-radius: 12px;
    padding: 1rem 1.1rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
/* Drag & Drop */
.mkt-panel-drag-handle {
    cursor: grab;
    color: rgba(245,245,240,0.2);
    font-size: 0.85rem;
    line-height: 1;
    padding: 0 4px 0 0;
    user-select: none;
    flex: 0 0 auto;
    transition: color 0.15s;
}
.mkt-panel-drag-handle:hover { color: rgba(245,245,240,0.5); }
.mkt-panel-drag-handle:active { cursor: grabbing; }

.mkt-panel-ghost { opacity: 0.35; background: rgba(250,185,0,0.06) !important; }

.mkt-panel-close {
    all: unset;
    cursor: pointer;
    font-size: 0.9rem;
    color: rgba(245,245,240,0.18);
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    flex: 0 0 auto;
    transition: color 0.15s, background 0.15s;
}
.mkt-panel-close:hover { color: #EF4444; background: rgba(239,68,68,0.1); }

.mkt-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}
.mkt-panel-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: rgba(245,245,240,0.5);
    text-transform: uppercase;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mkt-panel-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: #F5F5F0;
}
.mkt-panel-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}
.mkt-panel-change.up   { background: rgba(52,211,153,0.1); color: #34D399; }
.mkt-panel-change.down { background: rgba(239,68,68,0.1);  color: #EF4444; }
.mkt-panel-change.flat { background: rgba(245,245,240,0.06); color: rgba(245,245,240,0.4); }

.mkt-panel-chart {
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.mkt-panel-vix-note {
    font-size: 0.65rem;
    color: rgba(245,245,240,0.35);
    text-align: center;
    padding: 0.25rem 0;
}

/* Watchlist */
.mkt-watchlist-section {
    border-top: 1px solid rgba(245,245,240,0.08);
    padding-top: 1rem;
}
.mkt-watchlist-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}
.mkt-watchlist-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: rgba(245,245,240,0.4);
    text-transform: uppercase;
}
.mkt-watchlist-add {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.mkt-search-wrap {
    position: relative;
}
.mkt-search-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(245,245,240,0.12);
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    color: #F5F5F0;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    width: 240px;
    outline: none;
    transition: border-color 0.2s;
}
.mkt-search-input:focus { border-color: rgba(250,185,0,0.35); }
.mkt-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 320px;
    background: #1a2035;
    border: 1px solid rgba(245,245,240,0.12);
    border-radius: 10px;
    z-index: 200;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.mkt-dd-item {
    display: grid;
    grid-template-columns: 70px 1fr 70px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}
.mkt-dd-item:hover { background: rgba(250,185,0,0.07); }
.mkt-dd-sym {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: #FAB900;
}
.mkt-dd-name {
    font-size: 0.75rem;
    color: rgba(245,245,240,0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mkt-dd-type {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    color: rgba(245,245,240,0.35);
    text-align: right;
    text-transform: uppercase;
}
.mkt-wl-add-btn {
    all: unset;
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(250,185,0,0.1);
    border: 1px solid rgba(250,185,0,0.3);
    color: #FAB900;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}
.mkt-wl-add-btn:hover { background: rgba(250,185,0,0.18); }
.mkt-wl-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.mkt-wl-empty {
    font-size: 0.75rem;
    color: rgba(245,245,240,0.3);
    font-family: 'JetBrains Mono', monospace;
}
.mkt-wl-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(245,245,240,0.1);
    border-radius: 8px;
    padding: 0.3rem 0.6rem 0.3rem 0.8rem;
}
.mkt-wl-item-sym {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: #F5F5F0;
}
.mkt-wl-item-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: rgba(245,245,240,0.55);
}
.mkt-wl-item-chg {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
}
.mkt-wl-item-chg.up   { color: #34D399; }
.mkt-wl-item-chg.down { color: #EF4444; }
.mkt-wl-del {
    all: unset;
    color: rgba(245,245,240,0.25);
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
    transition: color 0.2s;
    padding: 2px;
}
.mkt-wl-del:hover { color: #EF4444; }

/* Economic Indicators grid */
.econ-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0.85rem;
}
.econ-card-panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(245,245,240,0.07);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.econ-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}
.econ-panel-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: rgba(245,245,240,0.4);
    text-transform: uppercase;
}
.econ-panel-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: #F5F5F0;
}
.econ-panel-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.econ-panel-date {
    font-size: 0.65rem;
    color: rgba(245,245,240,0.3);
    font-family: 'JetBrains Mono', monospace;
}
.econ-panel-trend {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}
.econ-panel-trend.up   { background: rgba(52,211,153,0.1);  color: #34D399; }
.econ-panel-trend.down { background: rgba(239,68,68,0.1);   color: #EF4444; }
.econ-panel-trend.flat { background: rgba(245,245,240,0.06); color: rgba(245,245,240,0.4); }
.econ-panel-chart {
    height: 80px;
    position: relative;
}

/* Responsive */
@media (max-width: 640px) {
    .mkt-indices-grid { grid-template-columns: 1fr; }
    .econ-grid { grid-template-columns: 1fr; }
    .mkt-modal-head { flex-direction: column; align-items: flex-start; }
    .mkt-search-input { width: 180px; }
    .mkt-search-dropdown { width: 260px; }
    .econ-mini-badges { gap: 0.6rem; }
    .econ-badges-wrap {
        border-left: none;
        border-right: none;
        border-top: 1px solid rgba(245,245,240,0.08);
        border-bottom: 1px solid rgba(245,245,240,0.08);
        padding: 0.6rem 0;
    }
}


/* ===== CAIMI FLOATING WIDGET ===== */

.caimi-widget-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a2035 0%, #0A0E1A 100%);
    border: 1.5px solid rgba(250, 185, 0, 0.55);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 24px rgba(250,185,0,0.12);
    cursor: pointer;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: caimiFloat 3.5s ease-in-out infinite;
    transition: box-shadow 0.2s ease;
    padding: 0;
    overflow: visible;
}
.caimi-widget-btn[hidden] { display: none !important; }
.caimi-widget-btn:hover {
    box-shadow: 0 6px 28px rgba(0,0,0,0.6), 0 0 36px rgba(250,185,0,0.22);
    animation-play-state: paused;
    transform: scale(1.07);
}

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

.caimi-widget-btn-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.caimi-widget-btn-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--gold);
    color: var(--navy);
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 5px;
    border-radius: 6px;
    line-height: 1;
    pointer-events: none;
}

/* Chat panel */
.caimi-widget-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 380px;
    height: 520px;
    background: rgba(10, 14, 26, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(250, 185, 0, 0.22);
    border-radius: 18px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.65), 0 0 32px rgba(250,185,0,0.06);
    z-index: 801;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(16px) scale(0.97);
    transform-origin: bottom right;
    transition:
        opacity 0.25s ease,
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        visibility 0s linear 0.25s;
}
.caimi-widget-panel.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.25s ease,
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        visibility 0s;
}

/* Header */
.caimi-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(245,245,240,0.08);
    flex-shrink: 0;
    background: linear-gradient(90deg, rgba(250,185,0,0.05) 0%, transparent 100%);
}
.caimi-widget-header-left { display: flex; align-items: center; gap: 0.6rem; }
.caimi-widget-header-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.caimi-widget-header-text { display: flex; flex-direction: column; }
.caimi-widget-title { font-family: var(--font-body); font-size: 0.95rem; font-weight: 600; color: var(--white); letter-spacing: 0.3px; }
.caimi-ai-accent { color: var(--gold); font-weight: 700; }
.caimi-widget-subtitle { font-family: var(--font-mono); font-size: 0.6rem; color: var(--white-faint); letter-spacing: 1px; text-transform: uppercase; }
.caimi-widget-header-actions { display: flex; gap: 0.4rem; }
.caimi-widget-action-btn {
    width: 28px; height: 28px; border-radius: 7px;
    background: transparent; border: 1px solid var(--border-subtle);
    color: var(--white-faint); cursor: pointer; font-size: 0.75rem;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
}
.caimi-widget-action-btn:hover { border-color: var(--gold); color: var(--gold); }

/* Messages */
.caimi-widget-messages {
    flex: 1; overflow-y: auto; padding: 0.85rem 0.85rem 0.4rem;
    display: flex; flex-direction: column; gap: 0.7rem;
    scroll-behavior: smooth;
}
.caimi-widget-messages::-webkit-scrollbar { width: 3px; }
.caimi-widget-messages::-webkit-scrollbar-thumb { background: rgba(245,245,240,0.1); border-radius: 2px; }

.caimi-widget-greeting {
    font-size: 0.85rem; color: var(--white-dim); line-height: 1.55;
    padding: 0.3rem 0;
    animation: fadeInUp 0.3s ease-out;
}
.caimi-widget-greeting strong { color: var(--gold); }

.caimi-widget-msg { max-width: 90%; display: flex; flex-direction: column; animation: fadeInUp 0.22s ease-out; }
.caimi-widget-msg.bot  { align-self: flex-start; }
.caimi-widget-msg.user { align-self: flex-end; }

.caimi-widget-bubble {
    font-size: 0.83rem; padding: 0.6rem 0.85rem; border-radius: 12px;
    line-height: 1.55; word-break: break-word;
}
.caimi-widget-msg.bot  .caimi-widget-bubble {
    background: rgba(26,32,53,0.95); border: 1px solid var(--border-subtle);
    border-bottom-left-radius: 4px; color: var(--white);
}
.caimi-widget-msg.user .caimi-widget-bubble {
    background: var(--gold); color: var(--navy);
    border-bottom-right-radius: 4px; font-weight: 500;
}

.caimi-widget-sources {
    font-size: 0.68rem; color: var(--white-faint); margin-top: 0.25rem;
    padding: 0 0.1rem; line-height: 1.4;
}
.caimi-widget-sources a { color: rgba(250,185,0,0.65); text-decoration: none; }
.caimi-widget-sources a:hover { color: var(--gold); }

.caimi-widget-time {
    font-family: var(--font-mono); font-size: 0.58rem; color: var(--white-faint);
    margin-top: 0.2rem; padding: 0 0.15rem;
}
.caimi-widget-msg.user .caimi-widget-time { text-align: right; }

/* Typing indicator */
.caimi-widget-typing {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.6rem 0.85rem;
    background: rgba(26,32,53,0.95); border: 1px solid var(--border-subtle);
    border-radius: 12px; border-bottom-left-radius: 4px; width: fit-content;
    align-self: flex-start;
}
.caimi-widget-typing span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--white-faint); animation: typing 1.4s ease-in-out infinite;
}
.caimi-widget-typing span:nth-child(2) { animation-delay: 0.2s; }
.caimi-widget-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Suggestion chips */
.caimi-widget-chips {
    padding: 0 0.85rem 0.35rem;
    display: flex; flex-direction: column; gap: 0.25rem;
    flex-shrink: 0;
}
.caimi-widget-chip {
    background: transparent;
    border: 1px solid rgba(250,185,0,0.14);
    border-radius: 6px; color: var(--white-faint);
    font-size: 0.69rem; padding: 0.28rem 0.6rem;
    cursor: pointer; text-align: left; line-height: 1.35;
    transition: all var(--transition-fast);
    font-family: var(--font-body);
}
.caimi-widget-chip:hover {
    background: rgba(250,185,0,0.08);
    border-color: rgba(250,185,0,0.35);
    color: var(--white-dim);
}

.caimi-widget-reset-hint {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--white-faint);
    line-height: 1.3;
    text-align: right;
    opacity: 0.7;
    max-width: 110px;
}

/* Input area */
.caimi-widget-input-area {
    padding: 0.65rem 0.85rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}
.caimi-widget-input-wrapper {
    display: flex; align-items: flex-end; gap: 0.45rem;
    background: rgba(5,7,20,0.8); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 0.42rem 0.5rem;
    transition: border-color var(--transition-fast);
}
.caimi-widget-input-wrapper:focus-within { border-color: rgba(250,185,0,0.38); }
.caimi-widget-input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--white); font-family: var(--font-body); font-size: 0.83rem;
    resize: none; max-height: 80px; line-height: 1.5;
}
.caimi-widget-input::placeholder { color: var(--white-faint); }
.caimi-widget-send-btn {
    width: 28px; height: 28px; border-radius: 6px;
    background: var(--gold); border: none; color: var(--navy);
    font-size: 0.72rem; cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast);
}
.caimi-widget-send-btn:hover:not(:disabled) { background: #ffc933; }
.caimi-widget-send-btn:disabled { background: var(--border-color); color: var(--white-faint); cursor: not-allowed; }

/* Mobile */
@media (max-width: 500px) {
    .caimi-widget-panel {
        left: 14px;
        right: 14px;
        width: auto;
        bottom: 82px;
        height: min(480px, calc(100dvh - 100px));
        transform-origin: bottom right;
    }
    .caimi-widget-btn { bottom: 20px; right: 14px; }
}

/* =============================================================================
   Market tile TF label + watchlist promote
   ============================================================================= */

/* Tiny timeframe label next to the tile badge (e.g. "5D", "1M", "YTD") */
.mkt-tile-tf-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    color: rgba(245,245,240,0.35);
    text-transform: uppercase;
    line-height: 1;
    vertical-align: middle;
}

/* Watchlist item name (used in "Aggiungi pannello" list) */
.mkt-wl-item-name {
    font-size: 0.72rem;
    color: rgba(245,245,240,0.45);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Promote to grid button */
.mkt-wl-promote {
    all: unset;
    cursor: pointer;
    width: 24px; height: 24px;
    border-radius: 6px;
    background: rgba(250,185,0,0.1);
    border: 1px solid rgba(250,185,0,0.25);
    color: #FAB900;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    flex: 0 0 auto;
    transition: background 0.15s;
}
.mkt-wl-promote:hover { background: rgba(250,185,0,0.2); }

/* Tile head badge+label row — stack vertically on small tiles */
.tile-head {
    flex-wrap: wrap;
    row-gap: 0.1rem;
}

/* =============================================================================
   Micro bar — compact monitoring strip between grid and "Aggiungi pannello"
   ============================================================================= */

.mkt-micro-section {
    margin: 0.85rem 0 0.5rem;
}
.mkt-micro-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.mkt-micro-label > span:first-child {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: rgba(245,245,240,0.35);
    text-transform: uppercase;
}
.mkt-micro-hint {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    color: rgba(245,245,240,0.2);
    font-style: italic;
}

.mkt-micro-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    min-height: 36px;
    padding: 0.4rem 0.6rem;
    border: 1px dashed rgba(245,245,240,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.015);
    transition: border-color 0.2s, background 0.2s;
}
.mkt-micro-bar.sortable-over {
    border-color: rgba(250,185,0,0.3);
    background: rgba(250,185,0,0.03);
}

.mkt-micro-empty {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: rgba(245,245,240,0.2);
    align-self: center;
    padding: 0 0.25rem;
}

/* Individual micro chip */
.mkt-micro-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(245,245,240,0.1);
    border-radius: 8px;
    padding: 0.3rem 0.55rem;
    cursor: default;
    transition: border-color 0.15s, background 0.15s;
}
.mkt-micro-chip:hover { border-color: rgba(245,245,240,0.2); }

.mkt-micro-chip-drag {
    cursor: grab;
    color: rgba(245,245,240,0.2);
    font-size: 0.8rem;
    user-select: none;
    transition: color 0.15s;
}
.mkt-micro-chip-drag:hover { color: rgba(245,245,240,0.5); }
.mkt-micro-chip-drag:active { cursor: grabbing; }

.mkt-micro-chip-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    color: #F5F5F0;
    white-space: nowrap;
}
.mkt-micro-chip-price {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: rgba(245,245,240,0.6);
    white-space: nowrap;
}
.mkt-micro-chip-chg {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}
.mkt-micro-chip-chg.up   { color: #34D399; }
.mkt-micro-chip-chg.down { color: #EF4444; }
.mkt-micro-chip-chg.flat { color: rgba(245,245,240,0.35); }

.mkt-micro-chip-close {
    all: unset;
    cursor: pointer;
    font-size: 0.75rem;
    color: rgba(245,245,240,0.2);
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1;
    transition: color 0.15s;
}
.mkt-micro-chip-close:hover { color: #EF4444; }

.mkt-micro-ghost {
    opacity: 0.3;
    border: 1px dashed rgba(250,185,0,0.4) !important;
}

/* Empty grid state */
.mkt-grid-empty {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: rgba(245,245,240,0.25);
    text-align: center;
    padding: 1.5rem;
    border: 1px dashed rgba(245,245,240,0.08);
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
}
