:root {
    --uva-blue: #232D4B;
    --uva-blue-dark: #141E3C;
    --uva-orange: #E57200;
    --uva-cyan: #009FDF;
    --uva-gray: #F1F1EF;
    --text-gray: #666666;
    --white: #FFFFFF;
    --green: #28a745;
    --red: #dc3545;
    --border: #dee2e6;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--uva-gray);
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-nav {
    background: var(--uva-blue);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 2rem;
}

.nav-links { display: flex; gap: 0.25rem; flex: 1; }
.nav-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}
.nav-user span { color: rgba(255,255,255,0.7); }
.nav-user a { color: var(--uva-orange); text-decoration: none; }

.content { flex: 1; padding: 1.5rem; max-width: 1400px; margin: 0 auto; width: 100%; }
.site-footer { text-align: center; padding: 1rem; color: var(--text-gray); font-size: 0.85rem; }

/* Flash Messages */
.flash-messages { margin-bottom: 1rem; }
.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}
.card-title { font-size: 1.05rem; font-weight: 600; color: var(--uva-blue); }
.card-meta { font-size: 0.85rem; color: var(--text-gray); }

/* Score Badges */
.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}
.score-high { background: #d4edda; color: #155724; }
.score-good { background: #d1ecf1; color: #0c5460; }
.score-medium { background: #fff3cd; color: #856404; }
.score-low { background: #f8d7da; color: #721c24; }
.score-none { background: #e9ecef; color: #6c757d; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-new { background: var(--uva-cyan); color: white; }
.status-reviewed { background: var(--uva-blue); color: white; }
.status-saved { background: var(--uva-orange); color: white; }
.status-dismissed { background: #6c757d; color: white; }
.status-expired { background: var(--red); color: white; }

/* Category tags */
.category-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--uva-gray);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--uva-blue);
    margin: 0.15rem 0.1rem;
}

/* Stats bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--uva-blue); }
.stat-label { font-size: 0.85rem; color: var(--text-gray); margin-top: 0.25rem; }
.stat-accent { color: var(--uva-orange); }

/* Filter bar */
.filter-bar {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-group label { font-size: 0.75rem; font-weight: 600; color: var(--text-gray); text-transform: uppercase; }
.filter-group select, .filter-group input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--uva-blue); color: white; }
.btn-primary:hover { background: var(--uva-blue-dark); }
.btn-orange { background: var(--uva-orange); color: white; }
.btn-orange:hover { opacity: 0.9; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-gray);
}
.btn-outline:hover { background: var(--uva-gray); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-danger { background: var(--red); color: white; }
.btn-success { background: var(--green); color: white; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-control:focus { outline: none; border-color: var(--uva-cyan); box-shadow: 0 0 0 2px rgba(0,159,223,0.15); }

/* Login page */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.login-container h1 {
    text-align: center;
    color: var(--uva-blue);
    margin-bottom: 0.5rem;
}
.login-subtitle {
    text-align: center;
    color: var(--text-gray);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* RFP list */
.rfp-list { display: flex; flex-direction: column; gap: 0.75rem; }
.rfp-card { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.rfp-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.rfp-card a { text-decoration: none; color: inherit; display: block; }
.rfp-description { font-size: 0.9rem; color: var(--text-gray); margin: 0.5rem 0; line-height: 1.5; }
.rfp-footer { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }

/* Detail page */
.detail-header { margin-bottom: 1.5rem; }
.detail-header h1 { font-size: 1.4rem; color: var(--uva-blue); margin-bottom: 0.5rem; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.detail-section { margin-bottom: 1.25rem; }
.detail-section h3 { color: var(--uva-blue); font-size: 0.95rem; margin-bottom: 0.5rem; border-bottom: 2px solid var(--uva-orange); padding-bottom: 0.25rem; display: inline-block; }
.detail-section p { font-size: 0.9rem; line-height: 1.6; color: #444; }
.info-row { display: flex; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--uva-gray); font-size: 0.9rem; }
.info-label { font-weight: 600; color: var(--uva-blue); min-width: 120px; }
.quick-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Scan status */
.scraper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.scraper-item {
    padding: 0.75rem;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--border);
    font-size: 0.85rem;
}
.scraper-item .state-name { font-weight: 600; color: var(--uva-blue); }
.scraper-active { border-left: 3px solid var(--green); }
.scraper-planned { border-left: 3px solid var(--text-gray); }
.scraper-error { border-left: 3px solid var(--red); }

/* Settings page */
.settings-section { margin-bottom: 2rem; }
.settings-section h2 { color: var(--uva-blue); font-size: 1.1rem; margin-bottom: 1rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { background: var(--uva-blue); color: white; text-align: left; padding: 0.6rem 0.75rem; font-weight: 600; }
td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
tr:hover td { background: rgba(0,159,223,0.04); }

/* Categories page */
.category-card { display: flex; justify-content: space-between; align-items: center; }
.category-info h4 { color: var(--uva-blue); margin-bottom: 0.25rem; }
.category-info p { font-size: 0.85rem; color: var(--text-gray); }
.category-keywords { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.35rem; }
.toggle-switch { position: relative; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0; background: #ccc; border-radius: 24px; cursor: pointer; transition: 0.3s;
}
.toggle-slider:before {
    content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: 0.3s;
}
input:checked + .toggle-slider { background: var(--green); }
input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.4rem; color: var(--uva-blue); }

/* Deadline countdown */
.deadline-urgent { color: var(--red); font-weight: 600; }
.deadline-soon { color: var(--uva-orange); font-weight: 600; }
.deadline-ok { color: var(--green); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-gray);
}
.empty-state h3 { margin-bottom: 0.5rem; color: var(--uva-blue); }

/* Modal */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 200; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: 12px; padding: 1.5rem; max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto; }
.modal h2 { color: var(--uva-blue); margin-bottom: 1rem; font-size: 1.1rem; }


/* Funding Level Badges */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.level-federal { background: #e8eaf6; color: #283593; }
.level-state { background: #e0f2f1; color: #00695c; }
.level-local { background: #fff3e0; color: #e65100; }

/* Responsive */
@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: 1fr 1fr; }
    .filter-bar { flex-direction: column; }
    .nav-links { display: none; }
}
