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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    min-height: 100vh;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #12121a;
    border-bottom: 1px solid #1e1e2e;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: #7c6ef0;
    text-decoration: none;
}

.nav-links { display: flex; gap: 8px; }

.nav-link {
    padding: 6px 14px;
    border-radius: 6px;
    color: #888;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: #e0e0e0;
    background: #1e1e2e;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Search */
.search-container { margin-bottom: 24px; }

.search-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    background: #12121a;
    border: 1px solid #2a2a3e;
    border-radius: 10px;
    color: #e0e0e0;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus { border-color: #7c6ef0; }

.search-input::placeholder { color: #555; }

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.person-card {
    background: #12121a;
    border: 1px solid #1e1e2e;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.person-card:hover {
    border-color: #7c6ef0;
    transform: translateY(-2px);
}

.person-card .name {
    font-size: 16px;
    font-weight: 600;
    color: #f0f0f0;
    margin-bottom: 4px;
}

.person-card .title {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
}

.person-card .confidence {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.confidence-high { background: #1a3a2a; color: #4ade80; }
.confidence-med { background: #3a3a1a; color: #facc15; }
.confidence-low { background: #3a1a1a; color: #f87171; }

/* Person Detail */
.person-detail { max-width: 800px; }

.person-header {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.person-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #1e1e2e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #555;
    flex-shrink: 0;
}

.person-info h1 {
    font-size: 24px;
    color: #f0f0f0;
    margin-bottom: 4px;
}

.person-info .meta {
    font-size: 14px;
    color: #888;
}

.section {
    margin-bottom: 24px;
}

.section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #7c6ef0;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #1e1e2e;
}

.timeline-item {
    padding: 12px 0 12px 20px;
    border-left: 2px solid #2a2a3e;
    position: relative;
}

.timeline-item::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7c6ef0;
    position: absolute;
    left: -5px;
    top: 16px;
}

.timeline-item.current::before { background: #4ade80; }

.timeline-item .job-title { font-weight: 600; color: #f0f0f0; }
.timeline-item .job-org { color: #888; font-size: 14px; }
.timeline-item .job-dates { color: #555; font-size: 13px; }

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #1e1e2e;
    font-size: 14px;
}

.data-table th {
    color: #888;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
}

/* Graph */
.graph-container {
    width: 100%;
    height: calc(100vh - 120px);
    background: #0a0a0f;
    border-radius: 10px;
    border: 1px solid #1e1e2e;
    overflow: hidden;
}

.graph-container svg { width: 100%; height: 100%; }

.graph-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.graph-controls input {
    padding: 8px 14px;
    background: #12121a;
    border: 1px solid #2a2a3e;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
}

.graph-controls input:focus { border-color: #7c6ef0; }

/* Admin */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.admin-panel {
    background: #12121a;
    border: 1px solid #1e1e2e;
    border-radius: 10px;
    padding: 16px;
}

.admin-panel h3 {
    font-size: 14px;
    font-weight: 600;
    color: #7c6ef0;
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 4px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    background: #0a0a0f;
    border: 1px solid #2a2a3e;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #7c6ef0;
    color: white;
}

.btn-primary:hover { background: #6b5ce0; }

/* Activity Feed */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 8px 0;
    border-bottom: 1px solid #1a1a24;
    font-size: 13px;
}

.activity-item .time {
    color: #555;
    font-size: 11px;
}

.activity-item .event {
    color: #e0e0e0;
}

.activity-item .event.error { color: #f87171; }
.activity-item .event.entity { color: #4ade80; }
.activity-item .event.scrape { color: #60a5fa; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-idle { background: #1e1e2e; color: #888; }
.badge-scraping { background: #1a2a3a; color: #60a5fa; }
.badge-parsing { background: #2a2a1a; color: #facc15; }
.badge-inferencing { background: #2a1a3a; color: #c084fc; }
.badge-error { background: #3a1a1a; color: #f87171; }
.badge-completed { background: #1a3a2a; color: #4ade80; }
.badge-pending { background: #1e1e2e; color: #888; }
.badge-running { background: #1a2a3a; color: #60a5fa; }

/* Back link */
.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: #7c6ef0;
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover { text-decoration: underline; }

.empty-state {
    text-align: center;
    padding: 48px;
    color: #555;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header h2 { color: #f0f0f0; font-size: 20px; }

.dashboard-stats {
    display: flex;
    gap: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num { font-size: 22px; font-weight: 700; color: #7c6ef0; }
.stat-label { font-size: 11px; color: #555; text-transform: uppercase; }

/* Agent Swarm */
.swarm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    min-height: 80px;
}

.swarm-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px;
    color: #555;
}

.agent-card {
    background: #0a0a0f;
    border: 1px solid #1e1e2e;
    border-radius: 10px;
    padding: 14px;
    transition: all 0.3s;
}

.agent-card.agent-scraping { border-color: #1a3a5a; box-shadow: 0 0 12px rgba(96, 165, 250, 0.1); }
.agent-card.agent-parsing { border-color: #3a3a1a; box-shadow: 0 0 12px rgba(250, 204, 21, 0.1); }
.agent-card.agent-inferencing { border-color: #2a1a4a; box-shadow: 0 0 12px rgba(192, 132, 252, 0.15); animation: pulse-glow 2s ease-in-out infinite; }
.agent-card.agent-deduplicating { border-color: #1a3a2a; box-shadow: 0 0 12px rgba(74, 222, 128, 0.1); }
.agent-card.agent-error { border-color: #3a1a1a; }

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 12px rgba(192, 132, 252, 0.1); }
    50% { box-shadow: 0 0 20px rgba(192, 132, 252, 0.25); }
}

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

.agent-icon { font-size: 18px; }
.agent-id { font-weight: 600; font-size: 13px; color: #e0e0e0; flex: 1; }
.agent-type { font-size: 11px; color: #555; margin-bottom: 6px; }
.agent-stage { font-size: 13px; color: #aaa; margin-bottom: 4px; }
.agent-url { font-size: 11px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }

.agent-stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #555;
}

/* Pipeline Steps */
.agent-pipeline {
    display: flex;
    align-items: center;
    margin: 8px 0;
    gap: 0;
}

.pipe-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0;
}

.pipe-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2a2a3e;
    transition: all 0.3s;
}

.pipe-step.active .pipe-dot { background: #7c6ef0; box-shadow: 0 0 6px #7c6ef0; }
.pipe-step.done .pipe-dot { background: #4ade80; }

.pipe-label { font-size: 9px; color: #444; margin-top: 2px; }
.pipe-step.active .pipe-label { color: #7c6ef0; }
.pipe-step.done .pipe-label { color: #4ade80; }

.pipe-line {
    flex: 1;
    height: 2px;
    background: #1e1e2e;
    min-width: 12px;
    margin: 0 2px;
    align-self: flex-start;
    margin-top: 3px;
}

/* Pipeline Feed */
.pipeline-feed {
    max-height: 500px;
    overflow-y: auto;
}

.pipe-event {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid #0f0f18;
    font-size: 13px;
    transition: background 0.2s;
}

.pipe-event:hover { background: #0f0f18; }
.pipe-event.pipe-error { border-left: 3px solid #f87171; }
.pipe-event.pipe-entity { border-left: 3px solid #4ade80; }
.pipe-event.pipe-llm { border-left: 3px solid #c084fc; }
.pipe-event.pipe-dedup { border-left: 3px solid #60a5fa; }
.pipe-event.pipe-scrape { border-left: 3px solid #888; }

.pipe-icon { font-size: 14px; flex-shrink: 0; }
.pipe-time { font-size: 11px; color: #444; flex-shrink: 0; width: 70px; }
.pipe-msg { color: #ccc; flex: 1; }
.pipe-url { font-size: 11px; color: #444; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Filter Buttons */
.btn-filter {
    padding: 4px 10px;
    border: 1px solid #2a2a3e;
    border-radius: 4px;
    background: transparent;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filter:hover { border-color: #7c6ef0; color: #e0e0e0; }
.btn-filter.active { background: #7c6ef0; border-color: #7c6ef0; color: white; }

.truncate { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-cell { font-size: 12px; color: #555; }

.badge-deduplicating { background: #1a3a2a; color: #4ade80; }
.badge-offline { background: #1e1e2e; color: #555; }
.badge-failed { background: #3a1a1a; color: #f87171; }
.badge-done { background: #1a3a2a; color: #4ade80; }

@media (max-width: 768px) {
    .admin-grid { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
    .swarm-grid { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; gap: 12px; }
}
