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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

nav {
    background: #1a1a2e;
    color: white;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
nav a { color: #e0e0e0; text-decoration: none; }
nav a:hover { color: white; }
.nav-brand a { font-size: 1.2rem; font-weight: 700; color: white; }
.nav-links a { margin-left: 1.5rem; }

main { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }

h1 { margin-bottom: 1rem; color: #1a1a2e; }
h2 { margin: 1.5rem 0 0.8rem; color: #333; }
h3 { margin: 1rem 0 0.5rem; }

a { color: #2563eb; }

.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-warning {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}
.btn-warning:hover { background: #d97706; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-top: 1rem;
}
th, td { padding: 0.7rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f8f9fa; font-weight: 600; font-size: 0.85rem; color: #666; text-transform: uppercase; }
tr:hover { background: #f8f9fa; }
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Scores */
.score { font-weight: 700; }
.score-high { color: #16a34a; }
.score-mid { color: #ca8a04; }
.score-low { color: #dc2626; }

.score-badge {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    margin: 0.5rem 0;
}
.score-badge.score-high { background: #dcfce7; color: #16a34a; }
.score-badge.score-mid { background: #fef9c3; color: #ca8a04; }
.score-badge.score-low { background: #fce4ec; color: #dc2626; }

/* Forms */
.form-discover { background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-group small { display: block; color: #888; font-size: 0.8rem; margin-top: 0.2rem; }
.input-with-btn { display: flex; gap: 0.5rem; }
.input-with-btn input { flex: 1; }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.85rem; white-space: nowrap; }

/* Status */
.status-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-top: 1rem;
}
.status-header { display: flex; justify-content: space-between; align-items: center; }
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-pending .status-badge { background: #e0e0e0; }
.status-discovering .status-badge, .status-prescreening .status-badge,
.status-enriching .status-badge, .status-analyzing .status-badge { background: #dbeafe; color: #2563eb; }
.status-complete .status-badge { background: #dcfce7; color: #16a34a; }
.status-failed .status-badge { background: #fce4ec; color: #dc2626; }
.status-progress { margin-top: 0.8rem; font-size: 1rem; }
.status-error { margin-top: 0.8rem; color: #dc2626; }
.status-time { font-size: 0.85rem; color: #888; }

.spinner {
    width: 24px; height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-top: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Profile detail */
.profile-card, .analysis-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}
.headline { color: #666; font-size: 1.1rem; margin-bottom: 0.5rem; }
.detail-table { width: 100%; margin: 1rem 0; border: none; box-shadow: none; }
.detail-table th { width: 140px; color: #888; font-weight: 500; font-size: 0.9rem; text-transform: none; vertical-align: top; background: none; }
.detail-table td { background: none; }
.section { margin-bottom: 1.2rem; }
.entry { margin-bottom: 0.8rem; padding-bottom: 0.6rem; border-bottom: 1px solid #f0f0f0; }
.entry:last-child { border-bottom: none; }
.dim { color: #888; }
.desc { color: #555; font-size: 0.9rem; margin-top: 0.3rem; line-height: 1.5; }
.back-link { display: inline-block; margin-bottom: 1rem; }
.skill-tag { display: inline-block; background: #eef2ff; color: #4338ca; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.85rem; margin: 0.15rem 0.2rem; }
.related-profiles { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.related-tag { display: inline-block; background: #f3f4f6; color: #333; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.85rem; text-decoration: none; }
.related-tag:hover { background: #e5e7eb; }

.strengths li { color: #16a34a; }
.concerns li { color: #ca8a04; }
ul { margin-left: 1.5rem; }
li { margin-bottom: 0.3rem; }

.empty { color: #888; padding: 2rem 0; }

.results-header { display: flex; justify-content: space-between; align-items: center; }

/* Market Research */
.market-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.market-actions { display: flex; gap: 0.5rem; align-items: center; }
.import-info { color: #888; font-size: 0.85rem; margin: 0.5rem 0; }
.import-result { background: #dcfce7; color: #16a34a; padding: 0.6rem 1rem; border-radius: 6px; margin: 0.5rem 0; }
.download-btn { background: #059669; color: white; border-color: #059669; }
.download-btn:hover { background: #047857; color: white; }

/* Filter bar */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end;
    background: white; padding: 1rem; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin: 1rem 0;
}
.filter-group { display: flex; flex-direction: column; }
.filter-group label { font-size: 0.75rem; font-weight: 600; color: #666; margin-bottom: 0.2rem; }
.filter-group select, .filter-group input {
    padding: 0.35rem 0.5rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.85rem; min-width: 100px;
}
.filter-search input { min-width: 180px; }

/* Job table */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
.table-scroll::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 30px;
    background: linear-gradient(to right, transparent, rgba(245,245,245,0.8));
    pointer-events: none;
}
.swipe-hint { color: #aaa; font-size: 0.8rem; margin-bottom: 0.3rem; }
.job-table { font-size: 0.85rem; min-width: 1100px; }
.job-table th { white-space: nowrap; }
.job-table th a { color: #666; text-decoration: none; }
.job-table th a:hover { color: #2563eb; }
.job-table td { padding: 0.4rem 0.6rem; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.source-tag { font-size: 0.75rem; color: #666; }
.table-info { color: #888; font-size: 0.85rem; margin: 0.5rem 0; }

/* Pagination */
.pagination { display: flex; gap: 0.3rem; align-items: center; margin: 1rem 0; flex-wrap: wrap; }
.page-current { background: #2563eb; color: white; padding: 0.3rem 0.6rem; border-radius: 4px; font-size: 0.85rem; }
.page-link { padding: 0.3rem 0.6rem; border: 1px solid #ddd; border-radius: 4px; text-decoration: none; font-size: 0.85rem; color: #333; }
.page-link:hover { background: #f3f4f6; }
.page-dots { color: #888; padding: 0 0.3rem; }

/* AI Chat */
.ai-chat { background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin: 1.5rem 0; }
.ai-chat h2 { font-size: 1.1rem; margin-bottom: 0.8rem; }
.ai-input-row { display: flex; gap: 0.5rem; align-items: center; }
.ai-input { flex: 1; padding: 0.5rem; border: 1px solid #ddd; border-radius: 6px; font-size: 0.95rem; }
.ai-answer { margin-top: 1rem; padding: 1rem; background: #f8f9fa; border-radius: 6px; line-height: 1.6; }
.ai-answer-text h1, .ai-answer-text h2, .ai-answer-text h3 { margin: 0.8rem 0 0.4rem; color: #1a1a2e; }
.ai-answer-text h1 { font-size: 1.15rem; }
.ai-answer-text h2 { font-size: 1.05rem; }
.ai-answer-text h3 { font-size: 0.95rem; }
.ai-answer-text ul, .ai-answer-text ol { margin: 0.4rem 0 0.4rem 1.5rem; }
.ai-answer-text li { margin-bottom: 0.25rem; }
.ai-answer-text p { margin: 0.4rem 0; }
.ai-answer-text strong { color: #1a1a2e; }
.ai-answer-text table { border-collapse: collapse; margin: 0.5rem 0; font-size: 0.9rem; }
.ai-answer-text th, .ai-answer-text td { border: 1px solid #ddd; padding: 0.3rem 0.6rem; }
.ai-answer-text th { background: #e9ecef; font-weight: 600; }
.ai-error { background: #fce4ec; color: #dc2626; }
.ai-query-details { margin-top: 0.8rem; font-size: 0.8rem; color: #888; }
.ai-query-details summary { cursor: pointer; }
.ai-query-details pre { background: #f0f0f0; padding: 0.5rem; border-radius: 4px; overflow-x: auto; margin-top: 0.3rem; font-size: 0.8rem; }

/* AI progress bar */
.ai-progress { margin-top: 0.8rem; }
.ai-progress-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.ai-progress-bar::after {
    content: '';
    position: absolute;
    top: 0; left: -40%;
    width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, #2563eb, transparent);
    animation: progress-slide 1.2s ease-in-out infinite;
}
@keyframes progress-slide {
    0% { left: -40%; }
    100% { left: 100%; }
}
.ai-progress-text { font-size: 0.8rem; color: #888; margin-top: 0.3rem; display: inline-block; }

/* HTMX indicators */
.spinner-inline { display: none; width: 16px; height: 16px; border: 2px solid #e0e0e0; border-top-color: #2563eb; border-radius: 50%; animation: spin 0.8s linear infinite; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
