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

:root {
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --nav-bg: #1e2a3a;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--nav-bg); }
.login-card { background: var(--card-bg); border-radius: 12px; padding: 48px 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-card .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.login-card .badge { display: inline-block; background: var(--success); color: white; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 12px; }

/* Top Nav */
.topnav { background: var(--nav-bg); padding: 0 32px; display: flex; align-items: center; height: 60px; position: sticky; top: 0; z-index: 100; gap: 0; }
.topnav-brand { color: white; font-size: 18px; font-weight: 700; margin-right: 40px; text-decoration: none; }
.topnav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.topnav-link { color: #94a3b8; text-decoration: none; padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.topnav-link:hover { background: rgba(255,255,255,.1); color: white; }
.topnav-link.active { background: var(--accent); color: white; }
.topnav-link-cta { background: #f97316; color: white !important; margin-left: 8px; }
.topnav-link-cta:hover { background: #ea580c !important; color: white !important; }
.topnav-link-cta.active { background: #c2410c !important; color: white !important; }
.topnav-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topnav-username { color: #94a3b8; font-size: 13px; }
.topnav-logout { color: #94a3b8; background: none; border: 1px solid rgba(255,255,255,.15); padding: 6px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; transition: background .15s, color .15s; }
.topnav-logout:hover { background: rgba(255,255,255,.1); color: white; }

/* Page content */
.page-content { max-width: 1200px; margin: 0 auto; padding: 32px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: 4px; font-size: 14px; }

/* Cards */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-body { padding: 24px; }

/* Tables */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--bg); padding: 12px 16px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f9fafb; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: background .15s; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #e5e7eb; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; color: var(--text); background: white; transition: border-color .15s, box-shadow .15s; font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Tags */
.tag { display: inline-block; padding: 2px 10px; background: #eff6ff; color: #1d4ed8; border-radius: 20px; font-size: 12px; font-weight: 500; margin: 2px; }

/* Badge */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-green { background: #d1fae5; color: #065f46; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; flex: 1; max-width: 360px; }
.search-box input { border: none; outline: none; font-size: 14px; flex: 1; background: transparent; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: #dbeafe; color: #1e3a5f; border: 1px solid #bfdbfe; }

/* Spinner */
.spinner { width: 20px; height: 20px; border: 2px solid #e5e7eb; border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state p { font-size: 15px; }

/* Vendor profile card */
.vendor-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; transition: box-shadow .15s; }
.vendor-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.vendor-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.vendor-card .meta { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.vendor-card .desc { font-size: 13px; color: #374151; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vendors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--card-bg); border-radius: 12px; width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); transform: translateY(10px); transition: transform .2s; overflow: hidden; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; }
.modal-body { padding: 24px; overflow-y: auto; }

/* MatchMaking results */
.match-card { background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%); border: 1px solid #bfdbfe; border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.match-card .match-num { display: inline-block; background: var(--accent); color: white; border-radius: 50%; width: 28px; height: 28px; line-height: 28px; text-align: center; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.match-card h3 { font-size: 18px; font-weight: 700; color: #1e3a5f; margin-bottom: 8px; }
.match-card .reason { font-size: 14px; color: #374151; line-height: 1.6; margin-bottom: 10px; }
.match-card .source-ref { font-size: 12px; color: var(--text-muted); font-style: italic; padding-top: 10px; border-top: 1px solid #bfdbfe; }

/* Initiative vendor list */
.init-vendor-pill { display: inline-flex; align-items: center; gap: 4px; background: #f3f4f6; border-radius: 6px; padding: 4px 10px; font-size: 13px; margin: 3px; }
.init-vendor-pill a { color: var(--accent); text-decoration: none; }
.init-vendor-pill a:hover { text-decoration: underline; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1f2937; color: white; padding: 12px 20px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.2); animation: slideIn .2s ease; }
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Loading */
.loading-overlay { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 60px; color: var(--text-muted); }

@media (max-width: 768px) {
  .topnav { padding: 0 16px; }
  .page-content { padding: 20px 16px; }
  .vendors-grid { grid-template-columns: 1fr; }
}
