:root {
    --primary: #1a365d;
    --secondary: #2c5282;
    --accent: #ed8936;
    --bg: #f7fafc;
    --text: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --tone-positive: #38a169;
    --tone-negative: #e53e3e;
    --tone-neutral: #a0aec0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--primary);
    color: white;
    padding: 30px 40px;
    border-radius: 8px;
    margin-bottom: 24px;
    text-align: center;
}
header h1 { font-size: 2em; margin-bottom: 4px; }
header .subtitle { opacity: 0.85; font-size: 1.1em; }
header .header-nav { margin-top: 12px; }
header .header-nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    margin: 0 12px;
    font-size: 0.95em;
}
header .header-nav a:hover { color: white; }
a.header-link { color: white; text-decoration: none; }

/* Layout */
.layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
}
.layout-entity {
    grid-template-columns: 280px 1fr;
}
@media (max-width: 768px) {
    .layout, .layout-entity {
        grid-template-columns: 1fr;
    }
}

/* Filters sidebar */
.filters {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    height: fit-content;
    position: sticky;
    top: 20px;
}
.filters h3 { margin-bottom: 16px; font-size: 1em; color: var(--secondary); }
.filter-group { margin-bottom: 14px; }
.filter-group label {
    display: block;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.filter-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9em;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
}
.btn-primary {
    background: var(--secondary);
    color: white;
    width: 100%;
    margin-top: 8px;
}
.btn-primary:hover { background: var(--primary); }
.btn-secondary {
    background: var(--card-bg);
    color: var(--secondary);
    border: 1px solid var(--border);
    display: block;
    margin: 20px auto;
}
.btn-secondary:hover { background: var(--bg); }

/* Feed */
.feed { min-height: 400px; }
.status {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Article card */
.article-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}
.article-card:hover { border-color: var(--secondary); }
.article-card .article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.article-card .article-title {
    font-size: 1em;
    font-weight: 600;
    line-height: 1.4;
}
.article-card .article-title a {
    color: var(--text);
    text-decoration: none;
}
.article-card .article-title a:hover { color: var(--secondary); }
.article-card .article-meta {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--text-muted);
}
.article-card .article-source {
    font-weight: 500;
    color: var(--secondary);
}
.article-card .article-entities {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.article-card .co-mentions {
    margin-top: 8px;
    font-size: 0.8em;
    color: var(--text-muted);
}

/* Tone indicator */
.tone-bar {
    width: 4px;
    min-height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}
.tone-positive { background: var(--tone-positive); }
.tone-negative { background: var(--tone-negative); }
.tone-neutral { background: var(--tone-neutral); }
.tone-value {
    font-size: 0.8em;
    font-weight: 600;
}

/* Entity badge */
.entity-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78em;
    font-weight: 500;
    text-decoration: none;
    background: #ebf4ff;
    color: var(--secondary);
    border: 1px solid #bee3f8;
}
.entity-badge:hover {
    background: #bee3f8;
}
.entity-badge.type-Candidate { background: #ebf4ff; color: #2c5282; border-color: #bee3f8; }
.entity-badge.type-Committee { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.entity-badge.type-Party { background: #fce7f3; color: #9d174d; border-color: #f9a8d4; }

/* Entity card (entity.html sidebar) */
.entity-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 8px;
    border: 1px solid var(--border);
    height: fit-content;
    position: sticky;
    top: 20px;
}
.entity-card h2 { font-size: 1.2em; margin-bottom: 8px; }
.entity-card .entity-meta {
    font-size: 0.9em;
    color: var(--text-muted);
}
.entity-card .entity-stat {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
}
.entity-card .entity-link {
    display: block;
    margin-top: 16px;
    text-align: center;
    color: var(--secondary);
    font-size: 0.9em;
}

/* Event card */
.event-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 10px;
}
.event-card .event-actors {
    font-weight: 600;
    margin-bottom: 4px;
}
.event-card .event-meta {
    font-size: 0.85em;
    color: var(--text-muted);
    display: flex;
    gap: 16px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
}
.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab.active {
    color: var(--secondary);
    border-bottom-color: var(--secondary);
    font-weight: 600;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Footer */
footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    font-size: 0.85em;
    color: var(--text-muted);
}
footer a { color: var(--secondary); }
