/* GrantFinder — Napier Digital */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --brand: #16a34a; --brand-light: #22c55e; --brand-dark: #14532d;
    --warning: #d97706; --danger: #dc2626; --bg: #f8fafc;
    --border: #e2e8f0; --text: #0f172a; --text-muted: #64748b; --radius: 10px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }

.navbar { background: var(--brand-dark); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 56px; position: sticky; top: 0; z-index: 100; }
.nav-brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 20px; }
.brand-name { color: white; font-size: 18px; font-weight: 700; }
.brand-tag { color: #86efac; font-size: 12px; background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 20px; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link { color: #bbf7d0; text-decoration: none; padding: 6px 14px; border-radius: 6px; font-size: 14px; transition: background 0.15s; }
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-cta { background: var(--brand); color: white !important; }
.nav-cta:hover { background: var(--brand-light) !important; }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: 16px; padding-left: 16px; border-left: 1px solid rgba(255,255,255,0.15); }
.nav-user span { color: #bbf7d0; font-size: 13px; }
.btn-logout { color: #bbf7d0; font-size: 13px; text-decoration: none; }
.btn-logout:hover { color: white; }

.container { max-width: 1280px; margin: 0 auto; padding: 24px 24px 48px; }
.alert { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }

.auth-wrapper { display: flex; justify-content: center; padding: 60px 16px; }
.auth-card { background: white; border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(0,0,0,0.06); }
.auth-logo { font-size: 24px; font-weight: 800; color: var(--brand); margin-bottom: 24px; }
.auth-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 14px; font-weight: 500; }
.form-group input { padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; outline: none; transition: border-color 0.15s; }
.form-group input:focus { border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(34,197,94,0.1); }
.auth-footer { margin-top: 20px; font-size: 14px; color: var(--text-muted); text-align: center; }
.auth-footer a { color: var(--brand); text-decoration: none; font-weight: 500; }

.btn-primary { background: var(--brand); color: white; border: none; padding: 11px 20px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; transition: background 0.15s; }
.btn-primary:hover { background: var(--brand-light); }
.btn-secondary { background: white; color: var(--brand); border: 2px solid var(--brand); }
.btn-secondary:hover, .btn-secondary.saved { background: var(--brand); color: white; }
.btn-full { width: 100%; text-align: center; }
.btn-scrape { background: var(--brand); color: white; border: none; padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.btn-scrape:hover:not(:disabled) { background: var(--brand-light); }
.btn-scrape:disabled { opacity: 0.6; cursor: default; }
.btn-sm { padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; border: none; transition: all 0.15s; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--brand-light); color: var(--brand); }
.btn-save { background: #f0fdf4; color: var(--brand); }
.btn-save:hover { background: var(--brand); color: white; }
.btn-saved { background: #dcfce7; color: #15803d; }
.btn-filter { background: var(--brand); color: white; padding: 8px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; }
.btn-clear { color: var(--text-muted); font-size: 14px; text-decoration: none; padding: 8px; }
.btn-clear:hover { color: var(--danger); }

.dashboard-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.dashboard-title h1 { font-size: 26px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.dashboard-title p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.dashboard-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.last-run { font-size: 12px; color: var(--text-muted); }
.count-badge { background: var(--brand); color: white; font-size: 14px; font-weight: 700; padding: 2px 10px; border-radius: 20px; }

.plan-bar { display: flex; align-items: center; justify-content: space-between; background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; font-size: 13px; }
.plan-bar-left { display: flex; align-items: center; gap: 10px; }
.plan-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.plan-free { background: #f1f5f9; color: #475569; }
.plan-pro  { background: #dcfce7; color: #166534; }
.plan-teams { background: #14532d; color: white; }
.plan-usage { color: var(--text-muted); }
.plan-progress-track { width: 100px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.plan-progress-fill { height: 100%; background: var(--brand); border-radius: 3px; }
.plan-bar-right { display: flex; align-items: center; gap: 12px; }
.plan-upgrade-link { color: var(--brand); font-weight: 600; text-decoration: none; font-size: 13px; }
.plan-upgrade-link:hover { text-decoration: underline; }
.plan-pricing-link { color: var(--text-muted); text-decoration: none; font-size: 13px; }
.plan-pricing-link:hover { color: var(--brand); }
.limit-banner { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 10px 16px; font-size: 13px; color: #166534; margin-bottom: 16px; }
.limit-banner a { color: var(--brand); font-weight: 600; }
.limit-warning { background: #fefce8; border-color: #fde047; color: #854d0e; }
.limit-warning a { color: #854d0e; }

.filters { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-input { padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; width: 240px; outline: none; }
.search-input:focus { border-color: var(--brand-light); }
.filter-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: white; outline: none; cursor: pointer; }

.grants-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.grant-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow 0.15s; }
.grant-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.grant-card.urgent { border-left: 4px solid var(--warning); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.badge-source { background: #f0fdf4; color: #166534; }
.badge-relevance { background: #f8fafc; color: #475569; }
.badge-eligible { background: #dcfce7; color: #15803d; }
.badge-flag { background: #fef3c7; color: #b45309; }

.deadline { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.urgent-text { color: var(--warning) !important; }
.warning-text { color: var(--warning); }
.ongoing { color: var(--brand); }

.card-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--brand); }
.card-funder { font-size: 13px; color: var(--text-muted); }
.card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.amount { font-weight: 600; color: var(--brand-dark); }
.card-actions { display: flex; gap: 6px; }

.empty-state { text-align: center; padding: 60px 24px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }

.back-link { color: var(--brand); text-decoration: none; font-size: 14px; font-weight: 500; display: inline-block; margin-bottom: 16px; }
.back-link:hover { text-decoration: underline; }
.detail-header { margin-bottom: 24px; }
.detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.detail-title { font-size: 26px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.detail-funder { font-size: 16px; color: var(--text-muted); }
.detail-grid { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.detail-main { display: flex; flex-direction: column; gap: 16px; }
.detail-section { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.detail-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.detail-section p { font-size: 15px; color: var(--text-muted); line-height: 1.6; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }
.sidebar-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.sidebar-card h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 12px; }
.sidebar-stat { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.sidebar-stat:last-child { border-bottom: none; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 13px; font-weight: 600; text-align: right; max-width: 160px; }
.text-warning { color: var(--warning); }

.spinner { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (max-width: 768px) {
    .grants-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .filter-form { flex-direction: column; align-items: stretch; }
    .search-input { width: 100%; }
}
