:root {
    /* Base Colors */
    --bg-main: #f9fafb;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;

    /* Performance Colors */
    --pos-color: #3d9970;
    /* Muted sage green */
    --neg-color: #e05252;
    /* Soft red */
    --amber-color: #d97706;
    /* Amber for neutral risk */

    /* Agent Identity */
    --ys-color: #1a1f2e;
    --yv-color: #7c4f1e;
    --gp-color: #166534;
    --cl-color: #9a3412;
    --gm-color: #1e3a8a;
    --tasi-color: #9ca3af;
}

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

body {
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: 'DM Mono', monospace;
}

/* Header */
header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 16px;
}

.signup-btn {
    background-color: var(--text-primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

/* Main Tabs Container */
.main-tabs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 24px 0 24px;
}

.tabs {
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    padding: 0 0 8px 0;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 2px solid var(--text-primary);
}

/* Dashboard Layout */
.dashboard {
    max-width: 1400px;
    margin: 32px auto 48px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

/* Left Panel */
.chart-section {
    margin-bottom: 24px;
}

.chart-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.chart-container {
    height: 400px;
    width: 100%;
    position: relative;
}

/* Risk Manager Section */
.risk-section {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.risk-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.risk-card h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.risk-card .agent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.risk-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 6px;
}

.risk-row:last-child {
    margin-bottom: 0;
}

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

.risk-val {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
}

.risk-val.good {
    color: var(--pos-color);
}

.risk-val.mid {
    color: var(--amber-color);
}

.risk-val.bad {
    color: var(--neg-color);
}

/* Agent Comments Section */
.agents-comments-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.comment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    transition: box-shadow 0.2s;
}

.comment-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.agent-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

.agent-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.agent-name {
    font-weight: 700;
    font-size: 13px;
}

.comment-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.chips-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-family: 'DM Mono', monospace;
    color: var(--text-primary);
}

/* Thesis Section */
.thesis-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.thesis-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
}

.thesis-header-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.thesis-agent {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
}

.thesis-val {
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

.thesis-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.thesis-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.thesis-card ul {
    list-style: none;
    /* Removed default bullets to customize */
    margin-bottom: 16px;
}

.thesis-card li {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-right: 16px;
    position: relative;
}

.thesis-card li::before {
    content: "•";
    position: absolute;
    right: 0;
    color: var(--border-color);
}

/* Right Panel */
.right-panel-content {
    margin-bottom: 24px;
}

.section-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.sub-tab {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 0 8px 0;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
}

.sub-tab.active {
    color: var(--text-primary);
    border-bottom: 2px solid var(--text-primary);
}

.view-panel {
    display: none;
}

.view-panel.active {
    display: block;
}

/* Leaderboard view */
.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.leaderboard-row.benchmark {
    opacity: 0.6;
    margin-top: 8px;
    border-top: 2px dashed var(--border-color);
    border-bottom: none;
}

.lb-rank {
    width: 28px;
    font-weight: 700;
    font-size: 16px;
}

.lb-agent {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.lb-stats {
    text-align: left;
}

.lb-val {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    font-size: 15px;
    display: block;
}

.lb-ret {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
}

/* Portfolio View */
.picker-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.picker-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.picker-btn.active {
    color: var(--text-primary);
    background: var(--bg-main);
    border-color: var(--text-primary);
}

.portfolio-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-val {
    font-size: 16px;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
}

.holdings-table {
    font-size: 13px;
}

.holding-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr;
    align-items: center;
    margin-bottom: 16px;
}

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

.holding-sym {
    font-family: 'DM Mono', monospace;
    font-weight: 600;
}

.holding-name {
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.holding-right {
    display: flex;
    justify-content: space-between;
    font-family: 'DM Mono', monospace;
    text-align: left;
}

.holding-bar-container {
    grid-column: 1 / -1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 6px;
    position: relative;
    overflow: hidden;
}

.holding-bar {
    height: 100%;
    border-radius: 2px;
    background: var(--pos-color);
}

/* Context Strip */
.context-strip h3 {
    font-size: 14px;
    margin-bottom: 16px;
}

.context-item {
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.context-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.context-item span:first-child {
    color: var(--text-secondary);
}

/* Utilities */
.pos {
    color: var(--pos-color);
}

.neg {
    color: var(--neg-color);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .risk-section {
        grid-template-columns: repeat(3, 1fr);
    }
}

.desktop-tagline {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .desktop-tagline {
        display: none !important;
    }
    .header-container {
        padding: 0 16px;
    }
    .header-right {
        gap: 12px !important;
    }
    .signup-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    .dashboard {
        margin: 20px auto 30px;
        padding: 0 16px;
        grid-template-columns: 1fr;
    }
    .card {
        padding: 16px;
    }
    .chart-container {
        height: 300px;
    }
    .risk-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .risk-card {
        padding: 12px;
    }
    .agents-comments-section {
        grid-template-columns: 1fr;
    }
    .picker-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    .stat-val {
        font-size: 14px;
    }
    .holding-row {
        font-size: 12px;
    }
    .main-tabs-container {
        padding: 16px 16px 0 16px;
    }
}

@media (max-width: 480px) {
    .risk-section {
        grid-template-columns: 1fr;
    }
    .portfolio-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .logo h1 {
        font-size: 16px;
    }
}