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

:root {
    --bg: #0a0e17;
    --bg-card: #111827;
    --bg-hover: #1a2332;
    --border: #1f2937;
    --border-hover: #374151;
    --text: #e0e0e0;
    --text-muted: #6b7280;
    --text-dim: #4b5563;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --white: #f0f0f0;
    --green: #34d399;
    --red: #f87171;
    --amber: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Layout: sidebar + main */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    flex-shrink: 0;
}
.sidebar-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    padding: 0 1.2rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.sidebar-group { margin-bottom: 0.5rem; }
.sidebar-group-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    padding: 0.5rem 1.2rem 0.2rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.15s, background 0.15s;
}
.sidebar-link:hover { color: var(--text); background: var(--bg-hover); }
.sidebar-link.active { color: var(--accent); background: rgba(96, 165, 250, 0.08); border-right: 2px solid var(--accent); }
.sidebar-icon { font-size: 0.9rem; width: 1.2rem; text-align: center; }
.sidebar-bottom {
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1100px;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.4rem; color: var(--white); }
.page-meta { font-size: 0.75rem; color: var(--text-muted); }

/* Section */
.section { margin-bottom: 2rem; }
.section h2 { font-size: 0.95rem; color: var(--white); margin-bottom: 0.8rem; }

/* Stat cards */
.stat-cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem 1.5rem;
    min-width: 140px;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Feed cards */
.feed-cards { display: flex; flex-direction: column; gap: 0.6rem; }
.feed-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    transition: border-color 0.15s;
}
.feed-card:hover { border-color: var(--border-hover); }
.feed-card-header { display: flex; justify-content: space-between; align-items: center; }
.feed-card-title { font-size: 0.9rem; font-weight: 600; color: var(--white); }
.feed-card-entries { font-size: 0.7rem; color: var(--text-muted); }
.feed-card-subtitle { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.feed-card-actions { margin-top: 0.4rem; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--white); margin-bottom: 0.3rem; }
.empty-state p { font-size: 0.85rem; margin-bottom: 1rem; }

/* Buttons */
.btn {
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border-hover);
    border-radius: 4px;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-small { font-size: 0.7rem; padding: 0.2rem 0.6rem; }
.btn-primary {
    background: var(--accent-hover);
    color: #fff;
    border-color: var(--accent-hover);
}
.btn-primary:hover { background: var(--accent); }

/* Forms */
.form-field { margin-bottom: 1rem; }
.form-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.form-field input {
    width: 100%;
    background: #1f2937;
    border: 1px solid var(--border-hover);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    color: var(--text);
    font-size: 0.9rem;
}
.form-field input:focus { outline: none; border-color: var(--accent); }
.form-field select, .form-select {
    width: 100%;
    background: #1f2937;
    border: 1px solid var(--border-hover);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    color: var(--text);
    font-size: 0.9rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    cursor: pointer;
}
.form-field select:focus { outline: none; border-color: var(--accent); }
.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
}
.toggle-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--green);
}

/* System monitor tabs */
.system-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}
.system-tab {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 6px 6px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.system-tab:hover { color: var(--text); }
.system-tab.active { background: var(--bg-card); color: var(--white); border-color: var(--border); }
.system-tab-badge {
    font-size: 0.6rem;
    font-weight: 700;
    background: #7f1d1d;
    color: #fca5a5;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.3rem;
}
.system-tab-panel { }

/* System monitor */
.system-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.system-table th {
    text-align: left; font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-dim); padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
}
.system-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); color: var(--text); }
.system-table tbody tr:hover { background: var(--bg-hover); }
.system-service-name { font-weight: 600; color: var(--white); font-family: monospace; }
.system-required-dot { color: var(--accent); font-size: 0.7rem; margin-left: 0.2rem; }
.system-mono { font-family: monospace; font-size: 0.75rem; color: var(--text-muted); }
.system-desc { color: var(--text-muted); font-size: 0.75rem; }
.system-status-badge {
    display: inline-block; font-size: 0.65rem; font-weight: 700;
    padding: 0.1rem 0.4rem; border-radius: 3px;
}
.system-status-badge.running { background: #064e3b; color: #6ee7b7; }
.system-status-badge.stopped { background: #1f2937; color: var(--text-dim); }

.system-stats-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.system-stat {
    background: var(--bg-hover); border-radius: 8px; padding: 0.7rem 1rem;
    min-width: 100px; text-align: center;
}
.system-stat-value { font-size: 1.4rem; font-weight: 700; color: var(--white); }
.system-stat-green { color: #6ee7b7; }
.system-stat-red { color: #fca5a5; }
.system-stat-label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.15rem; }

.system-section-label {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 0.4rem;
}
.system-group-card {
    background: var(--bg-hover); border-radius: 6px;
    padding: 0.5rem 0.7rem; margin-bottom: 0.4rem;
}
.system-group-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.system-group-name { font-weight: 600; font-family: monospace; font-size: 0.8rem; color: var(--white); }
.system-pending-badge {
    font-size: 0.6rem; font-weight: 700; padding: 0.1rem 0.35rem;
    border-radius: 3px; background: #7f1d1d; color: #fca5a5;
}
.system-pending-badge.small { font-size: 0.55rem; padding: 0.05rem 0.25rem; }
.system-consumer {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.15rem 0 0.15rem 0.8rem; font-size: 0.75rem;
}
.system-consumer-name { font-family: monospace; color: var(--text); }
.system-consumer-idle { color: var(--text-dim); font-size: 0.7rem; }

.system-event-types { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.system-event-type {
    display: flex; align-items: center; gap: 0.3rem;
    background: var(--bg-hover); border-radius: 4px; padding: 0.2rem 0.5rem;
}
.system-event-type-name { font-family: monospace; font-size: 0.7rem; color: var(--text); }
.system-event-type-count { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); }

.system-error-card {
    background: #1a0a0a;
    border: 1px solid #451a1a;
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.4rem;
}
.system-error-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.2rem;
}
.system-error-source-link {
    color: var(--white);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
}
.system-error-source-link:hover { color: var(--accent); }
.system-error-message {
    font-size: 0.78rem;
    color: #fca5a5;
    line-height: 1.4;
    margin-bottom: 0.2rem;
}
.system-error-msg {
    font-size: 0.72rem;
    color: #fca5a5;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.system-error-msg:hover { white-space: normal; overflow: visible; }
.system-failure-count {
    font-weight: 700;
    color: #fca5a5;
    font-size: 0.85rem;
}

/* Source article list */
.source-article-list { display: flex; flex-direction: column; gap: 0.2rem; }
.source-article-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
}
.source-article-item:last-child { border-bottom: none; }
.source-article-title {
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.source-article-title:hover { color: var(--accent); }
.source-article-date {
    font-size: 0.7rem;
    color: var(--text-dim);
    flex-shrink: 0;
    font-family: monospace;
}

.source-filter-add-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.source-filter-input {
    flex: 1;
    background: #1f2937;
    border: 1px solid var(--border-hover);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    color: var(--text);
    font-size: 0.85rem;
}
.source-filter-input:focus { outline: none; border-color: var(--accent); }
.title-filter-entries { display: flex; flex-direction: column; gap: 0.4rem; }
.title-filter-entry {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
}
.title-filter-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.title-filter-pattern { font-size: 0.85rem; font-weight: 600; color: var(--white); }
.title-filter-count {
    font-size: 0.65rem;
    color: var(--text-muted);
    background: #1f2937;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}
.title-filter-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 0.2rem;
}
.title-filter-remove:hover { color: #fca5a5; }
.title-filter-matches { margin-top: 0.4rem; }
.title-filter-matches-toggle {
    font-size: 0.7rem;
    color: var(--text-dim);
    cursor: pointer;
    list-style: none;
}
.title-filter-matches-toggle::-webkit-details-marker { display: none; }
.title-filter-matches-toggle::before { content: '+ '; }
.title-filter-matches[open] .title-filter-matches-toggle::before { content: '- '; }
.title-filter-matches-toggle:hover { color: var(--text-muted); }
.title-filter-match-list { margin-top: 0.3rem; }
.title-filter-match {
    padding: 0.15rem 0;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}
.title-filter-match-title { color: var(--text); }
.title-filter-match-url { color: var(--text-dim); font-size: 0.65rem; }

.system-pipeline-status {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    text-transform: uppercase;
}
.system-pipeline-status.gate_failed { background: #7f1d1d; color: #fca5a5; }
.system-pipeline-status.failed { background: #4a1d1d; color: #f87171; }

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; }
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-group-summary {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.2rem 0; font-size: 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover); padding-left: 0.3rem; border-radius: 3px;
}
.activity-group-count {
    display: inline-block; background: var(--accent); color: var(--bg);
    font-size: 0.6rem; font-weight: 700; padding: 0.1rem 0.4rem;
    border-radius: 8px;
}
.activity-time {
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
    flex-shrink: 0;
    width: 55px;
    margin-right: 0.45rem;
}
.activity-type {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    flex-shrink: 0;
    white-space: nowrap;
    min-width: fit-content;
}
.activity-type-article { background: #1e3a5f; color: #93c5fd; }
.activity-type-task { background: #1f2937; color: var(--text-muted); }
.activity-type-pipeline { background: #064e3b; color: #6ee7b7; }
.activity-type-collection { background: #78350f; color: #fcd34d; }
.activity-detail {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.activity-source {
    font-size: 0.65rem;
    color: var(--text-dim);
    flex-shrink: 0;
}
.activity-extra {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: monospace;
    flex-shrink: 0;
}

/* Security events */
.security-ip-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.security-ip-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-hover);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
}
.security-ip { font-family: monospace; color: var(--white); font-weight: 600; }
.security-ip-count { font-size: 0.65rem; color: var(--text-muted); }
.security-type-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: #7f1d1d;
    color: #fca5a5;
    white-space: nowrap;
}

/* Mastodon queue */
.mastodon-queue-list { display: flex; flex-direction: column; }
.mastodon-queue-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.mastodon-queue-item:last-child { border-bottom: none; }
.mastodon-queue-info { flex: 1; min-width: 0; }
.mastodon-queue-title { font-size: 0.85rem; color: var(--white); }
.mastodon-queue-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
    flex-wrap: wrap;
}
.queue-checkbox { width: auto; accent-color: var(--green); flex-shrink: 0; }

.system-refresh-bar {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.7rem; color: var(--text-dim);
}
.system-refresh-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--amber); display: inline-block;
    transition: background 0.2s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* Login page */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-container { width: 100%; max-width: 380px; padding: 1rem; }
.login-brand {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 2rem;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2rem;
}
.login-card h2 {
    font-size: 1.1rem;
    color: var(--white);
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-error {
    color: var(--red);
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 1rem;
}
.btn-login {
    width: 100%;
    padding: 0.6rem;
    background: var(--accent-hover);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}
.btn-login:hover { background: var(--accent); }
.btn-passkey {
    background: #1e293b; border: 1px solid var(--border); color: var(--text);
}
.btn-passkey:hover { background: #334155; }
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
}
.login-footer a { color: var(--text-muted); font-size: 0.8rem; text-decoration: none; }
.login-footer a:hover { color: var(--accent); }

/* Tags */
.tag-pill {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    background: #1f2937;
    color: var(--text-muted);
    border-radius: 3px;
    display: inline-block;
}
.tag-pill.small { font-size: 0.6rem; }

/* Card sections */
.card-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1rem;
}
.card-section h2 { font-size: 0.85rem; color: var(--white); margin-bottom: 0.6rem; }
.card-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}
.maintenance-task {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.maintenance-task:last-child { border-bottom: none; }
.maintenance-task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.3rem;
}
.maintenance-task-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.1rem;
}
.section-hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.8rem; }

/* Form helpers */
.form-row { display: flex; gap: 1rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.form-actions { margin-top: 1rem; }
.inline-form-row { display: flex; gap: 0.8rem; align-items: flex-end; }
.muted { color: var(--text-dim) !important; }

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.3rem 0;
}
.checkbox-label input[type="checkbox"] { accent-color: var(--accent); }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.2rem; }

/* Feed URL */
.feed-url-row { display: flex; gap: 0.5rem; }
.feed-url-row input { flex: 1; }
.feed-card-cats { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.3rem; }

/* Search */
.search-bar { display: flex; gap: 0.8rem; margin-bottom: 1.5rem; }
.search-bar input { flex: 1; background: #1f2937; border: 1px solid var(--border-hover); border-radius: 6px; padding: 0.6rem 0.8rem; color: var(--text); font-size: 0.9rem; }
.search-bar input:focus { outline: none; border-color: var(--accent); }
.search-advanced { margin-bottom: 1rem; }
.search-advanced-toggle {
    font-size: 0.7rem;
    color: var(--text-dim);
    cursor: pointer;
    list-style: none;
}
.search-advanced-toggle::-webkit-details-marker { display: none; }
.search-advanced-toggle::before { content: '+ '; }
.search-advanced[open] .search-advanced-toggle::before { content: '- '; }
.search-advanced-toggle:hover { color: var(--text-muted); }
.search-advanced-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-hover);
    border-radius: 6px;
}
.search-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    flex-wrap: wrap;
}
.search-option input[type="checkbox"] { width: auto; accent-color: var(--green); }
.search-option-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    width: 100%;
    padding-left: 1.4rem;
    margin-top: -0.2rem;
}
.results-count { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Articles */
.article-list { display: flex; flex-direction: column; gap: 0.4rem; }
.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.article-card summary {
    padding: 0.7rem 1rem;
    cursor: pointer;
    list-style: none;
}
.article-card summary::-webkit-details-marker { display: none; }
.article-card[open] { border-color: var(--border-hover); }
.article-title { font-size: 0.85rem; color: var(--white); font-weight: 500; margin-bottom: 0.2rem; }
.article-meta { display: flex; gap: 0.5rem; align-items: center; }
.article-date { font-size: 0.65rem; color: var(--text-dim); }
.article-detail { padding: 0 1rem 0.8rem; }
.article-summary { font-size: 0.8rem; color: var(--text); line-height: 1.5; margin-bottom: 0.5rem; }
.article-tags { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-bottom: 0.5rem; }
.article-link { font-size: 0.8rem; color: var(--accent); text-decoration: none; }
.article-link:hover { text-decoration: underline; }

/* Sources */
.sources-toolbar { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.5rem; }
.sources-toolbar .search-bar { margin-bottom: 0; }
.search-dropdown-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.8rem; cursor: pointer;
    border-bottom: 1px solid var(--border);
    text-decoration: none; color: var(--text);
}
.search-dropdown-item:hover { background: var(--bg-hover); }
.search-dropdown-new {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.8rem; cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.search-dropdown-new:hover { background: var(--bg-hover); }
.search-dropdown-new:last-child, .search-dropdown-item:last-child { border-bottom: none; }
.source-filter-details { margin-bottom: 1rem; }
.source-filter-toggle {
    font-size: 0.7rem;
    color: var(--text-dim);
    cursor: pointer;
    list-style: none;
}
.source-filter-toggle::-webkit-details-marker { display: none; }
.source-filter-toggle::before { content: '+ '; }
.source-filter-details[open] .source-filter-toggle::before { content: '- '; }
.source-filter-toggle:hover { color: var(--text-muted); }
.source-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}
.source-filter-btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.source-filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.source-filter-btn.active { background: var(--bg-hover); color: var(--white); border-color: var(--border-hover); }
.add-collection-info {
    background: var(--bg-hover);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.6rem; }
.source-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.7rem 0.8rem;
    text-decoration: none;
    display: block;
    transition: border-color 0.15s;
}
.source-card:hover { border-color: var(--accent); }
.source-card-header { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.3rem; }
.source-card-icon { width: 20px; height: 20px; border-radius: 3px; flex-shrink: 0; }
.source-card { position: relative; }
.source-card-name { font-size: 0.85rem; font-weight: 500; color: var(--white); }
.source-status-icon {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    font-size: 0.6rem;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.source-status-icon.valid { color: var(--green); }
.source-status-icon.warn { color: var(--amber); }
.source-status-icon.invalid { color: var(--red); }
.source-status-icon.stale-feed { color: var(--amber); }
.source-status-icon.unchecked { color: var(--text-dim); font-size: 0.55rem; }
.source-card-url { font-size: 0.65rem; color: var(--text-dim); display: block; word-break: break-all; }
.source-archived { opacity: 0.45; }
.system-stat.clickable { cursor: pointer; transition: border-color 0.15s; border: 1px solid transparent; border-radius: 8px; }
.system-stat.clickable:hover { border-color: var(--accent); }
.source-archived:hover { opacity: 0.7; }

/* Source detail */
.source-detail-header { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 1.2rem; }
.source-detail-icon { width: 40px; height: 40px; border-radius: 6px; flex-shrink: 0; }
.source-detail-url { font-size: 0.8rem; color: var(--accent); text-decoration: none; }
.source-detail-url:hover { text-decoration: underline; }

/* Textarea */
.form-textarea {
    width: 100%;
    background: #1f2937;
    border: 1px solid var(--border-hover);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
}
.form-textarea:focus { outline: none; border-color: var(--accent); }

.url-field-row { display: flex; gap: 0.5rem; }
.url-field-row input { flex: 1; }

/* Source validation */
.validate-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.3rem 0;
}
.validate-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-hover);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.validate-elapsed {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-left: auto;
    font-family: monospace;
}
.validate-status { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
.validate-status.valid { color: var(--green); }
.validate-status.invalid { color: var(--red); }
.validate-type { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.validate-status.warn { color: var(--amber); }
.validate-hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.validate-error { font-size: 0.8rem; color: var(--red); }
.validate-suggestions { margin-top: 0.6rem; }
.validate-suggestion-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.validate-suggestion { background: var(--bg-hover); border-radius: 6px; padding: 0.6rem; margin-bottom: 0.4rem; }
.validate-suggestion-header { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.validate-suggestion-title { font-size: 0.85rem; font-weight: 500; color: var(--white); }
.validate-suggestion-url { font-size: 0.65rem; color: var(--text-dim); word-break: break-all; margin-bottom: 0.3rem; }

/* Collection log */
.collection-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.collection-log-table th {
    text-align: left;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
}
.collection-log-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}
.collection-log-table tbody tr:hover { background: var(--bg-hover); }
.collection-time { color: var(--text-muted); white-space: nowrap; }
.collection-duration { color: var(--text-muted); white-space: nowrap; }
.collection-error { color: var(--red); font-size: 0.72rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-error:hover { white-space: normal; overflow: visible; }
.collection-status-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}
.collection-status-badge.success { background: #064e3b; color: #6ee7b7; }
.collection-status-badge.unchanged { background: #1e3a5f; color: #93c5fd; }
.collection-status-badge.error { background: #7f1d1d; color: #fca5a5; }

/* Collection entries */
.collection-entries-row td { padding: 0; border-bottom: 1px solid var(--border); }
.collection-entries-details { padding: 0.2rem 0.5rem 0.4rem; }
.collection-entries-summary {
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0;
}
.collection-entries-summary:hover { color: var(--accent); }
.collection-entries { padding: 0.2rem 0; }
.collection-entry {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0;
    font-size: 0.75rem;
}
.collection-entry-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.05rem 0.3rem;
    border-radius: 2px;
    flex-shrink: 0;
}
.collection-entry.new .collection-entry-badge { background: #064e3b; color: #6ee7b7; }
.collection-entry.known .collection-entry-badge { background: #1f2937; color: var(--text-dim); }
.collection-entry-link {
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.collection-entry-link:hover { color: var(--accent); }
.collection-entry.known .collection-entry-link { color: var(--text-muted); }

/* Selector discovery */
.selector-code {
    font-family: monospace;
    font-size: 0.78rem;
    background: #1e293b;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    color: #93c5fd;
}
.selector-samples { margin-top: 0.3rem; }
.selector-sample { font-size: 0.75rem; padding: 0.1rem 0; }
.selector-sample-link { color: var(--text-muted); text-decoration: none; }
.selector-sample-link:hover { color: var(--accent); }

/* Enrich */
.enrich-fields { display: flex; flex-direction: column; gap: 0.5rem; }
.enrich-field { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.enrich-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); width: 80px; flex-shrink: 0; }
.enrich-value { font-size: 0.85rem; color: var(--white); flex: 1; }
.enrich-desc { font-size: 0.8rem; color: var(--text); }
.enrich-signals { font-size: 0.7rem; color: var(--text-dim); }
.validate-articles { display: flex; flex-direction: column; gap: 0.2rem; }
.validate-article { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding: 0.2rem 0; }
.validate-article-title { font-size: 0.8rem; color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.validate-article-title:hover { text-decoration: underline; }
.validate-article-date { font-size: 0.65rem; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }

/* Alerts */
.alert {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.alert-error { background: #1a0a0a; border: 1px solid #7f1d1d; color: var(--red); }
.alert-success { background: #0a1a0f; border: 1px solid #064e3b; color: var(--green); }
.alert-warn { background: #1a1400; border: 1px solid #78350f; color: var(--amber); }
.alert-exists { background: #1a1400; border: 1px solid #78350f; color: var(--amber); display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem; }

/* Article filter tabs */
.article-filters {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1rem;
}
.filter-tab {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
}
.filter-tab:hover { border-color: var(--border-hover); color: var(--text); }
.filter-tab.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.filter-tab.small { padding: 0.25rem 0.6rem; font-size: 0.68rem; }

/* Article state badges */
.article-state-badge {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 600;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    vertical-align: middle;
}
.article-state-badge.approved { background: #064e3b; color: #6ee7b7; }
.article-state-badge.rejected { background: #7f1d1d; color: #fca5a5; }
.article-state-badge.unprocessed { background: #78350f; color: #fcd34d; }

/* Rejection card */
.rejection-card {
    background: #1a0a0a;
    border: 1px solid #7f1d1d;
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.8rem;
}
.rejection-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}
.rejection-icon { color: #fca5a5; font-size: 0.9rem; }
.rejection-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #fca5a5;
}
.rejection-task {
    padding: 0.5rem 0.6rem;
    background: #1f0f0f;
    border-radius: 6px;
    margin-bottom: 0.4rem;
}
.rejection-task:last-child { margin-bottom: 0; }
.rejection-task-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}
.rejection-task-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fca5a5;
    font-family: monospace;
}
.rejection-task-model {
    font-size: 0.6rem;
    color: var(--text-dim);
    background: #2a1515;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
}
.rejection-reason {
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.5;
}
.rejection-factors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.3rem;
}
.rejection-factor {
    font-size: 0.7rem;
    background: #2a1515;
    color: var(--text-muted);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}
.rejection-raw {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* Incomplete card */
.incomplete-card {
    background: #1a1400;
    border: 1px solid #78350f;
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.8rem;
}
.incomplete-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.incomplete-icon { color: #fcd34d; font-size: 0.9rem; }
.incomplete-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #fcd34d;
}
.incomplete-tasks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}
.incomplete-task-pill {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    font-family: monospace;
}
.incomplete-task-pill.passed { background: #064e3b; color: #6ee7b7; }
.incomplete-task-pill.failed { background: #7f1d1d; color: #fca5a5; }
.incomplete-task-pill.skipped { background: #1f2937; color: var(--text-dim); }

/* Article state: incomplete */
.article-state-badge.incomplete { background: #78350f; color: #fcd34d; }
.article-state-badge.failed { background: #4a1d1d; color: #f87171; }

/* Article detail meta */
.article-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 0.8rem;
}
.article-meta-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    display: block;
    margin-bottom: 0.1rem;
}

/* Investigate */
.investigate-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1.2rem;
}
.investigate-tab {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
}
.investigate-tab:hover { border-color: var(--border-hover); color: var(--text); }
.investigate-tab.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.investigate-tab.disabled { color: var(--text-dim); cursor: default; border-color: var(--border); opacity: 0.5; }
.investigate-tab.disabled:hover { border-color: var(--border); color: var(--text-dim); }
.investigate-summary { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Sector list */
.sector-list { display: flex; flex-direction: column; gap: 0.4rem; }
.sector-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    text-decoration: none;
    transition: border-color 0.15s;
}
.sector-card:hover { border-color: var(--accent); }
.sector-card-header { display: flex; justify-content: space-between; align-items: center; }
.sector-card-name { font-size: 0.9rem; font-weight: 600; color: var(--white); }
.sector-card-count { font-size: 1.1rem; font-weight: 700; color: var(--white); }
.sector-card-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.15rem;
}
.sector-gics { font-family: monospace; }
.sector-card-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 0.4rem;
    position: relative;
    overflow: hidden;
}
.sector-card-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #1e3a5f;
    border-radius: 2px;
}
.sector-card-bar-target {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #7f1d1d;
    border-radius: 2px;
}
.sector-card-stats {
    display: flex;
    gap: 0.8rem;
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

/* Sector detail */
.sector-article-list { display: flex; flex-direction: column; }
.sector-article-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.sector-article-item:last-child { border-bottom: none; }
.sector-article-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.sector-article-title {
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sector-article-title:hover { color: var(--accent); }
.sector-article-date {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: monospace;
    flex-shrink: 0;
}
.sector-article-evidence {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    line-height: 1.4;
}
.sector-inferred-badge {
    font-size: 0.6rem;
    color: var(--text-dim);
    background: #1f2937;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* Topics */
.topic-list { display: flex; flex-direction: column; gap: 0.5rem; }
.topic-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    text-decoration: none;
    transition: border-color 0.15s;
}
.topic-card:hover { border-color: var(--accent); }
.topic-card-header { display: flex; justify-content: space-between; align-items: center; }
.topic-card-name { font-size: 0.95rem; font-weight: 600; color: var(--white); }
.topic-card-count { font-size: 0.75rem; color: var(--text-muted); }
.topic-card-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; line-height: 1.4; }
.topic-description { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5; }

.topic-facet-list { display: flex; flex-direction: column; gap: 0.3rem; }
.topic-facet-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background: var(--bg-hover);
    border-radius: 6px;
}
.topic-facet-name { font-size: 0.85rem; font-weight: 500; color: var(--white); }
.topic-facet-desc { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.1rem; }
.topic-facet-count { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }

.topic-package-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.topic-package-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-hover);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
}
.topic-package-name { font-weight: 600; font-family: monospace; color: var(--white); }
.topic-package-versions { font-size: 0.65rem; color: var(--text-dim); font-family: monospace; }

.topic-article-matches { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.2rem; }
.topic-match-pill {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-weight: 600;
}
.topic-match-pill.tag { background: #1e3a5f; color: #93c5fd; }
.topic-match-pill.keyword { background: #78350f; color: #fcd34d; }
.topic-match-pill.technique { background: #064e3b; color: #6ee7b7; }

.entry-title-link { color: inherit; text-decoration: none; }
.entry-title-link:hover { color: var(--accent); }

/* Article detail page */
.article-pipeline-run {
    background: var(--bg-hover);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.4rem;
}
.article-pipeline-run-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.article-task-card {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.4rem;
}
.article-task-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    list-style: none;
}
.article-task-summary::-webkit-details-marker { display: none; }
.article-task-card[open] { border-color: var(--border-hover); }
.article-task-name {
    font-weight: 600;
    font-family: monospace;
    font-size: 0.82rem;
    color: var(--white);
}
.article-task-detail {
    padding: 0 0.7rem 0.5rem;
    border-top: 1px solid var(--border);
}
.article-task-result { margin-top: 0.4rem; }
.article-task-field {
    display: flex;
    gap: 0.5rem;
    padding: 0.2rem 0;
    font-size: 0.78rem;
    border-bottom: 1px solid var(--border);
}
.article-task-field:last-child { border-bottom: none; }
.article-task-field-key {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 120px;
    flex-shrink: 0;
    font-family: monospace;
    font-size: 0.72rem;
}
.article-task-field-value {
    color: var(--text);
    word-break: break-word;
    white-space: pre-wrap;
}

/* Activity feed article link */
.activity-article {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.activity-article:hover { color: var(--accent); }

/* Feed entry list */
.entry-list { display: flex; flex-direction: column; gap: 0.3rem; }

.entry-divider {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 0.8rem 0 0.3rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.2rem;
}
.entry-divider:first-child { padding-top: 0; }

.entry-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s;
}
.entry-item:hover { border-color: var(--border-hover); }
.entry-item[open] { border-color: var(--border-hover); }

/* Read state */
.entry-item.read { opacity: 0.55; }
.entry-item.read .entry-title { font-weight: 400; font-size: 0.8rem; }
.entry-item.read .entry-meta { display: none; }
.entry-item.read:hover { opacity: 0.8; }
.entry-item.read[open] { opacity: 1; }
.entry-item.read[open] .entry-meta { display: flex; }

/* New entries indicator */
.new-indicator {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: var(--accent);
    color: var(--bg);
    cursor: pointer;
    margin-left: 0.5rem;
    animation: pulse-new 1.5s ease-in-out infinite;
}
@keyframes pulse-new { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.entry-summary {
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    list-style: none;
}
.entry-summary::-webkit-details-marker { display: none; }

.entry-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-status-dot {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    border-radius: 50%;
    cursor: help;
}
.article-status-dot.approved { color: #6ee7b7; }
.article-status-dot.rejected { color: #fca5a5; }
.article-status-dot.failed { color: #f87171; }
.article-status-dot.incomplete { color: #fcd34d; }
.article-status-dot.unprocessed { color: var(--text-dim); }

.entry-date-end {
    flex-shrink: 0;
    font-size: 0.65rem;
    color: var(--text-dim);
    white-space: nowrap;
    font-family: var(--mono);
}

.entry-date-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 36px;
    flex-shrink: 0;
}
.entry-date-day { font-size: 0.9rem; font-weight: 700; color: var(--white); line-height: 1.1; }
.entry-date-month { font-size: 0.5rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }
.entry-date-time { font-size: 0.5rem; color: var(--text-dim); }

.entry-favicon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    flex-shrink: 0;
}
.entry-favicon-placeholder {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-dim);
    background: #1f2937;
    border-radius: 3px;
    flex-shrink: 0;
}

.entry-info { flex: 1; min-width: 0; }
.entry-title {
    font-size: 0.85rem;
    color: var(--white);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.entry-meta {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    font-size: 0.6rem;
}
.entry-category {
    color: var(--text-muted);
}
.entry-source { color: var(--text-dim); }
.entry-date { color: var(--text-dim); }

/* Entry detail (expanded) */
.entry-detail {
    padding: 0 0.8rem 0.8rem;
    padding-left: 2.4rem;  /* align with title (favicon + gap) */
}
.entry-section { margin-bottom: 0.6rem; }
.entry-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 0.2rem;
}
.entry-section-content {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.6;
}
.entry-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin: 0.5rem 0;
}
.entry-tag {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    background: #1f2937;
    color: var(--text-muted);
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}
.entry-tag:hover { background: var(--accent); color: var(--bg); }

.reader-source-link { font-size: 0.8rem; color: var(--accent); text-decoration: none; display: block; margin-top: 0.3rem; }
.reader-source-link:hover { text-decoration: underline; }

/* Feed card as link */
.feed-card-link { text-decoration: none; display: block; }
.feed-card-link:hover { border-color: var(--accent); }

/* Reports */
.report-list { display: flex; flex-direction: column; gap: 0.5rem; }
.report-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.8rem 1rem;
    text-decoration: none;
    transition: border-color 0.15s;
}
.report-card:hover { border-color: var(--accent); }
.report-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
.report-type-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: #1e3a5f;
    color: #93c5fd;
}
.report-date { font-size: 0.7rem; color: var(--text-dim); }
.report-title { font-size: 0.9rem; color: var(--white); font-weight: 500; }

/* Report detail view */
.report-view {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}
.report-view-header { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 1rem; }
.report-content { font-size: 0.9rem; color: var(--text); line-height: 1.7; }
.report-content h1 { font-size: 1.3rem; color: var(--white); margin: 1.5rem 0 0.5rem; }
.report-content h2 { font-size: 1.1rem; color: var(--white); margin: 1.2rem 0 0.4rem; }
.report-content h3 { font-size: 0.95rem; color: var(--white); margin: 1rem 0 0.3rem; }
.report-content p { margin-bottom: 0.6rem; }
.report-content ul, .report-content ol { margin: 0.4rem 0 0.6rem 1.5rem; }
.report-content li { margin-bottom: 0.2rem; }
.report-content code { background: #1f2937; padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.85em; }
.report-content pre { background: #0f1520; padding: 0.8rem; border-radius: 6px; overflow-x: auto; margin: 0.6rem 0; }
.report-content pre code { background: none; padding: 0; }
.report-content a { color: var(--accent); }
.report-content table { border-collapse: collapse; width: 100%; margin: 0.6rem 0; }
.report-content th, .report-content td { border: 1px solid var(--border); padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.report-content th { background: #1f2937; color: var(--text-muted); text-align: left; }

/* Custom select */
.custom-select { position: relative; }
.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1f2937;
    border: 1px solid var(--border-hover);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: border-color 0.15s;
}
.custom-select-trigger:hover { border-color: var(--accent); }
.custom-select-arrow { color: var(--text-muted); font-size: 0.7rem; }
.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #1a2332;
    border: 1px solid var(--border-hover);
    border-radius: 6px;
    z-index: 10;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.custom-select-option {
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    transition: background 0.1s;
}
.custom-select-option:hover { background: var(--bg-hover); }
.custom-select-option.selected { background: rgba(96, 165, 250, 0.1); border-left: 2px solid var(--accent); }
.option-name { font-size: 0.85rem; color: var(--white); font-weight: 500; }
.option-desc { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.1rem; }

/* Stage timeline (SSE) */
.stage-timeline { display: flex; flex-direction: column; gap: 0.4rem; }

.stage-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.stage-block.active { border-color: var(--amber); }
.stage-block.passed { border-color: var(--green); border-color: #064e3b; }
.stage-block.failed { border-color: var(--red); border-color: #7f1d1d; }

.stage-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    list-style: none;
}
.stage-header::-webkit-details-marker { display: none; }

.stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.stage-dot.pending { background: var(--border-hover); }
.stage-dot.active { background: var(--amber); animation: pulse 1s ease-in-out infinite; }
.stage-dot.passed { background: var(--green); }
.stage-dot.failed { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.stage-label { font-size: 0.9rem; color: var(--white); font-weight: 500; flex: 1; }
.stage-block.pending .stage-label { color: var(--text-muted); }

.stage-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}
.stage-badge.active { background: #78350f; color: #fde68a; }
.stage-badge.passed { background: #064e3b; color: #6ee7b7; }
.stage-badge.failed { background: #7f1d1d; color: #fca5a5; }

.stage-tasks {
    padding: 0 0.8rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.stage-task {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0 0.2rem 1rem;
    font-size: 0.8rem;
}
.task-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.task-dot.pending { background: var(--border-hover); }
.task-dot.passed { background: var(--green); }
.task-dot.failed { background: var(--red); }
.task-name { color: var(--text); }
.stage-task.pending .task-name { color: var(--text-dim); }

.event-badge {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}
.event-badge.passed { background: #064e3b; color: #6ee7b7; }
.event-badge.failed { background: #7f1d1d; color: #fca5a5; }

/* Mobile */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-brand { font-size: 0.7rem; padding: 0 0.5rem 0.8rem; text-align: center; }
    .sidebar-link { padding: 0.5rem; justify-content: center; font-size: 0; }
    .sidebar-link .sidebar-icon { font-size: 1.1rem; }
    .main-content { padding: 1rem; }
    .stat-cards { flex-direction: column; }
}
