@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

/* Brand colors
   --navy:      #003F74  (dark navy — nav, dark backgrounds)
   --blue:      #0084C9  (bright blue — links, buttons, interactive)
   --red:       #ED1C24  (bright red — accents, MSP brand)
   --dark-red:  #B3161B  (dark red — negative sentiment, warnings)
*/

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  color: #111827;
  background: #f0f4f8;
  min-height: 100vh;
}

/* ── Nav ── */
nav {
  background: #003F74;
  color: #f9fafb;
  padding: 0 32px;
  display: flex;
  align-items: center;
  height: 60px;
  gap: 28px;
}
nav .brand {
  font-weight: 800;
  font-size: 18px;
  color: #ffffff;
  text-decoration: none;
  letter-spacing: -0.2px;
}
nav .brand span { color: #ED1C24; }
nav a {
  color: #93c5e8;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
nav a:hover, nav a.active { color: #ffffff; }
nav .spacer { flex: 1; }
nav .user {
  font-size: 12px;
  color: #7aafce;
  display: flex;
  align-items: center;
  gap: 12px;
}
nav .user form { display: inline; }
nav .user button {
  background: none;
  border: 1px solid #1a5a8a;
  color: #93c5e8;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
nav .user button:hover { border-color: #0084C9; color: #ffffff; }

/* ── Search bar ── */
.search-bar {
  background: #002a52;
  padding: 10px 24px;
  position: relative;
  border-bottom: 1px solid #001e3d;
}
.search-bar input {
  width: 100%;
  max-width: 480px;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid #1a5a8a;
  background: #003F74;
  color: #f9fafb;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.search-bar input::placeholder { color: #7aafce; }
.search-bar input:focus { border-color: #0084C9; }
#search-results {
  position: absolute;
  top: calc(100% + 2px);
  left: 24px;
  width: 480px;
  background: #003F74;
  border: 1px solid #1a5a8a;
  border-radius: 6px;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#search-results a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  color: #f9fafb;
  text-decoration: none;
  font-size: 13px;
}
#search-results a:hover { background: #0084C9; }
#search-results .cat-badge { font-size: 11px; color: #93c5e8; }

/* ── Page layout ── */
.page { max-width: 1200px; margin: 0 auto; padding: 32px 28px; }

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #dde3ea;
  padding: 24px 32px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #003F74;
  margin-bottom: 16px;
}

/* ── Vendor header ── */
.vendor-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
  border-left: 4px solid #0084C9;
}
.vendor-header h1 { font-size: 22px; font-weight: 800; color: #003F74; }
.vendor-header .meta { color: #6b7280; font-size: 13px; margin-top: 4px; }
.vendor-header .meta a { color: #0084C9; text-decoration: none; }
.vendor-header .meta a:hover { text-decoration: underline; }
.vendor-header .description { margin-top: 10px; line-height: 1.6; color: #374151; }
.badge-ticker { background: #003F74; color: #fff; font-weight: 700; font-size: 11px; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 4px; text-decoration: none; }
.badge-ticker:hover { background: #0084C9; }

.funding-amount { font-weight: 600; color: #111827; }
.funding-total { margin-top: 10px; font-size: 13px; color: #6b7280; text-align: right; }

.why-text { font-size: 14px; line-height: 1.7; color: #374151; }
.why-text.empty { color: #9ca3af; font-size: 13px; }
.why-text p { margin-bottom: 10px; }
.why-text p:last-child { margin-bottom: 0; }
.why-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.why-list li { padding-left: 20px; position: relative; font-size: 14px; line-height: 1.6; color: #374151; }
.why-list li::before { content: '•'; position: absolute; left: 4px; color: #0084C9; font-weight: 700; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}
.badge-msp     { background: #dbeafe; color: #003F74; }
.badge-cat     { background: #f0f4f8; color: #374151; }
.badge-ai      { background: #fff3cd; color: #92400e; }
.badge-curated { background: #dcfce7; color: #166534; }
.badge-created { background: #ede9fe; color: #5b21b6; }
.badge-bot     { background: #dbeafe; color: #003F74; }

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 16px 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-value { font-size: 36px; font-weight: 800; color: #003F74; }
.stat-label { font-size: 14px; color: #6b7280; margin-top: 4px; }
.stat-trend { font-size: 28px; }
.trend-up   { color: #16a34a; }
.trend-down { color: #B3161B; }
.trend-flat { color: #9ca3af; }

/* ── Sentiment coloring ── */
.sent-very-positive { color: #15803d; font-weight: 600; }
.sent-positive      { color: #16a34a; font-weight: 600; }
.sent-neutral       { color: #6b7280; }
.sent-negative      { color: #B3161B; font-weight: 600; }
.sent-very-negative { color: #7f1d1d; font-weight: 600; }

/* Raw score shown beneath the label in stat cards */
.stat-sub  { font-size: 13px; color: #9ca3af; margin-top: 2px; }
/* Inline score beside label in tables */
.sent-score { font-size: 12px; color: #9ca3af; margin-left: 4px; }

/* ── Controls row ── */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.controls label { font-size: 12px; color: #6b7280; }
.controls select {
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  color: #003F74;
}

/* ── Chart container ── */
.chart-container { position: relative; height: 180px; }

/* ── Posts list ── */
.post-item {
  border-bottom: 1px solid #f0f4f8;
  padding: 12px 0;
}
.post-item:last-child { border-bottom: none; }
.post-meta {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 4px;
  display: flex;
  gap: 10px;
}
.post-summary { line-height: 1.6; color: #374151; }
.post-toggle { font-size: 13px; color: #0084C9; margin-left: 6px; white-space: nowrap; }
.post-toggle:hover { text-decoration: underline; }

.summary-main { line-height: 1.7; color: #374151; }
.summary-bullets { padding-left: 18px; color: #374151; line-height: 1.7; }
.summary-bullets li { margin-bottom: 4px; }
.summary-details { margin-top: 8px; }
.summary-details summary {
  cursor: pointer;
  color: #0084C9;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  display: inline-block;
  padding: 2px 0;
}
.summary-details summary::-webkit-details-marker { display: none; }
.summary-details summary:hover { text-decoration: underline; }
.summary-details[open] summary { color: #006fa8; }
.summary-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #003F74;
  margin-top: 12px;
  margin-bottom: 4px;
}
.summary-section-body { line-height: 1.7; color: #374151; font-size: 14px; }

/* ── News list ── */
.news-item {
  border-bottom: 1px solid #f0f4f8;
  padding: 12px 0;
}
.news-item:last-child { border-bottom: none; }
.news-headline { font-weight: 600; margin-bottom: 4px; }
.news-headline a { color: #111827; text-decoration: none; }
.news-headline a:hover { color: #0084C9; }
.news-meta { font-size: 11px; color: #9ca3af; display: flex; gap: 10px; }
.news-summary { font-size: 13px; color: #6b7280; margin-top: 4px; line-height: 1.5; }
.news-signal { font-size: 11px; font-style: italic; color: #9ca3af; }

/* ── Vendor table (product lines, etc.) ── */
.vendor-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.vendor-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #9ca3af;
  border-bottom: 1px solid #e5e7eb;
  padding: 6px 8px 8px;
}
.vendor-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #f3f4f6;
  color: #111827;
}
.vendor-table tr:last-child td { border-bottom: none; }
.vendor-table a { color: #0084C9; text-decoration: none; }
.vendor-table a:hover { text-decoration: underline; }

/* ── Browse table ── */
.browse-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.browse-filters select, .browse-filters input {
  padding: 7px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #003F74;
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #003F74;
  padding: 10px 14px;
  border-bottom: 2px solid #dde3ea;
}
td {
  padding: 13px 14px;
  border-bottom: 1px solid #f0f4f8;
  vertical-align: top;
  font-size: 15px;
}
tr:hover td { background: #f8fafc; }
td a { color: #0084C9; text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }
td .muted { color: #9ca3af; font-size: 12px; }

/* ── Candidate cards ── */
.candidate-card {
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.candidate-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #f0f4f8;
  background: #f8fafc;
  border-left: 4px solid #0084C9;
}
.candidate-name { font-size: 16px; font-weight: 700; flex: 1; color: #003F74; }
.candidate-meta { font-size: 12px; color: #6b7280; }
.candidate-meta a { color: #0084C9; }
.candidate-body { padding: 14px 18px; }
.snippets { margin-bottom: 14px; }
.snippet {
  background: #f8fafc;
  border-left: 3px solid #0084C9;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #374151;
  border-radius: 0 4px 4px 0;
}
.snippet-meta { font-size: 11px; color: #9ca3af; margin-bottom: 4px; }
.candidate-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.candidate-actions details { flex: 1; min-width: 280px; }
.candidate-actions summary {
  cursor: pointer;
  color: #0084C9;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 0;
  list-style: none;
}
.candidate-actions summary::-webkit-details-marker { display: none; }
.watch-form {
  margin-top: 10px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #dde3ea;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.watch-form input, .watch-form textarea, .watch-form select {
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  color: #111827;
}
.watch-form textarea { resize: vertical; min-height: 60px; }
.watch-form label { font-size: 12px; color: #6b7280; font-weight: 500; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary   { background: #0084C9; color: #fff; }
.btn-primary:hover { background: #006fa8; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger    { background: #fff; color: #B3161B; border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fff5f5; }
.btn-secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #f9fafb; }

/* ── Status tabs ── */
.status-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #dde3ea;
}
.status-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.status-tab:hover { color: #003F74; }
.status-tab.active { color: #0084C9; border-bottom-color: #0084C9; }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #003F74;
  background: linear-gradient(135deg, #003F74 0%, #002a52 100%);
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 48px;
  text-align: center;
  width: 340px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
.login-card .login-brand {
  font-size: 22px;
  font-weight: 800;
  color: #003F74;
  margin-bottom: 4px;
}
.login-card .login-brand span { color: #ED1C24; }
.login-card p  { color: #6b7280; font-size: 13px; margin-bottom: 28px; }
.btn-google {
  width: 100%;
  padding: 10px;
  background: #fff;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-google:hover { background: #f9fafb; border-color: #0084C9; }
.login-error { color: #B3161B; font-size: 13px; margin-top: 14px; }

/* ── Empty states ── */
.empty { color: #9ca3af; font-size: 13px; padding: 24px 0; text-align: center; }

/* ── Digest page ── */
.digest-range-card { margin-bottom: 20px; }
.digest-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.digest-controls label { font-size: 12px; color: #6b7280; font-weight: 500; }
.digest-controls input[type=date] {
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #003F74;
  background: #fff;
}
.digest-range-summary {
  margin-top: 10px;
  font-size: 12px;
  color: #9ca3af;
}
.digest-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #003F74;
  margin-bottom: 10px;
}
.digest-meta {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 16px;
}
.draft-prose { line-height: 1.8; }
.draft-line { margin: 5px 0; color: #374151; }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h2 { font-size: 24px; font-weight: 800; color: #003F74; }

/* ── Table scroll wrapper (prevents horizontal page overflow on mobile) ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Card layout helpers ── */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}
.card-header-row .card-title,
.card-title-row .card-title { margin-bottom: 0; }
.card-hint { font-size: 12px; color: #9ca3af; }
/* Compact card variant for single-line filter/control rows */
.card-filter {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
}

/* ── Inline select (outside a .controls wrapper) ── */
.select-sm {
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #003F74;
  cursor: pointer;
}

/* ── Vendor detail helpers ── */
.vendor-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.vendor-parent-link {
  margin-bottom: 8px;
  font-size: 13px;
  color: #6b7280;
}
.stats-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.stats-controls label { font-size: 12px; color: #6b7280; }

/* ── Pagination bar ── */
.pagination-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  margin-top: 16px;
}

/* ── Notes display (candidates watching state) ── */
.notes-display {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #166534;
}

/* ── Surveys page ── */
.survey-import-heading {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  color: #003F74;
}
.survey-import-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.survey-import-field { flex: 1; min-width: 200px; }
.survey-import-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}
.survey-import-field input[type="text"],
.survey-import-field input[type="file"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.survey-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.survey-title-text  { font-size: 16px; font-weight: 600; color: #003F74; }
.survey-question-text { font-size: 13px; color: #6b7280; margin-top: 2px; }
.survey-card-meta   { text-align: right; flex-shrink: 0; }
.survey-date        { font-size: 13px; color: #9ca3af; }
.survey-count       { font-size: 12px; color: #9ca3af; }
.survey-answers     { margin-top: 8px; }
.survey-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.survey-bar-label   { width: 160px; font-size: 13px; color: #374151; flex-shrink: 0; }
.survey-bar-track   { flex: 1; background: #eef4fa; border-radius: 3px; height: 18px; overflow: hidden; }
.survey-bar-fill    { height: 100%; background: #0084C9; border-radius: 3px; /* width set inline — dynamic % */ }
.survey-bar-count   { width: 80px; font-size: 13px; color: #6b7280; text-align: right; flex-shrink: 0; }
.survey-bar-pct     { color: #9ca3af; }

/* ── Network page ── */
.page-subtitle { font-size: 14px; color: #6b7280; margin: 4px 0 20px; }

.tab-row {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid #dde3ea;
}
.tab-btn {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-family: inherit;
}
.tab-btn:hover { color: #003F74; }
.tab-btn.active { color: #0084C9; border-bottom-color: #0084C9; }
.badge-count {
  display: inline-block;
  background: #e5e7eb;
  color: #374151;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
}
.tab-btn.active .badge-count { background: #dbeafe; color: #1d4ed8; }
.ev-unconfirmed { color: #9ca3af; }
.unconfirmed-badge { color: #9ca3af; font-size: 11px; }
.nowrap { white-space: nowrap; }

.network-controls { padding: 16px 20px; }
.controls-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.control-group label { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.control-group select {
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  color: #003F74;
}
.btn-primary {
  padding: 7px 18px;
  background: #0084C9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  align-self: flex-end;
}
.btn-primary:hover { background: #006fa8; }
.network-stats { margin-top: 10px; font-size: 12px; color: #9ca3af; }

.network-legend { padding: 12px 20px; }
.legend-items { display: flex; flex-wrap: wrap; gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #374151; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.network-graph-card { padding: 12px; overflow: hidden; }
.network-graph-card svg { display: block; }

.network-link { font-size: 12px; color: #0084C9; text-decoration: none; }
.network-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════
   RESPONSIVE — tablet (≤768px) and phone (≤480px)
   Two-row nav reflow; no hamburger JS needed.
   ══════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Nav: brand on first row, links on second */
  nav {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px;
    gap: 0;
    row-gap: 6px;
  }
  nav .brand { flex-basis: 100%; }
  nav .spacer { display: none; }
  nav .user { flex-basis: 100%; order: 3; padding-bottom: 6px; }
  /* Nav links sit on their own row between brand and user */
  nav a:not(.brand) { font-size: 14px; margin-right: 12px; }

  /* Reduce page chrome padding */
  .page { padding: 20px 16px; }
  .card { padding: 16px 18px; }

  /* Stats: 2 columns on tablet */
  .stats-row { grid-template-columns: repeat(2, 1fr); }

  /* Page header: allow wrapping */
  .page-header { flex-wrap: wrap; gap: 8px; }

  /* Search results: don't overflow the viewport */
  #search-results { width: calc(100vw - 32px); }
}

@media (max-width: 480px) {
  /* Stats: single column on phone */
  .stats-row { grid-template-columns: 1fr; }

  /* Give stat values a bit more breathing room */
  .stat-value { font-size: 28px; }

  /* Tighten card and page further */
  .page { padding: 12px 12px; }
  .card { padding: 14px 14px; margin-bottom: 16px; }

  /* Search bar full width */
  .search-bar { padding: 8px 12px; }
  .search-bar input { max-width: 100%; }
  #search-results { width: calc(100vw - 24px); left: 12px; }

  /* Login card: constrain to screen width */
  .login-card { width: calc(100vw - 32px); padding: 28px 24px; }

  /* Browse filters: full-width selects */
  .browse-filters select,
  .browse-filters input { width: 100%; }

  /* Digest controls: stack */
  .digest-controls { flex-direction: column; align-items: flex-start; }

  /* Survey bar chart: shrink label/count so the bar track stays visible */
  .survey-bar-label { width: 110px; }
  .survey-bar-count { width: 60px; }
}

/* ── Analyst page ── */
.code-block {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem 1.2rem;
  font-family: monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  color: #1f2937;
}
.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  color: #1e40af;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 13px;
  color: #9ca3af;
  border-top: 1px solid #e5e7eb;
  margin-top: 40px;
}
footer a { color: #9ca3af; text-decoration: none; }
footer a:hover { color: #0084C9; }
.footer-sep { margin: 0 8px; }

/* ── Verification system ─────────────────────────────────────────────────── */
.badge-flagged {
  background: #fef3c7; color: #92400e;
  border: 1px solid #fbbf24;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  padding: 1px 7px; margin: 0 3px; vertical-align: middle;
}
.badge-ai-sm {
  background: #f3f4f6; color: #6b7280;
  border-radius: 8px; font-size: 10px; font-weight: 600;
  padding: 1px 5px; margin-right: 4px; vertical-align: middle;
}
.action-btn {
  background: none; border: 1px solid #e5e7eb; border-radius: 4px;
  cursor: pointer; font-size: 12px; padding: 1px 6px; margin-left: 4px;
  vertical-align: middle; color: #6b7280; line-height: 1.4;
  transition: background 0.15s, border-color 0.15s;
}
.action-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.action-btn.approve-btn { color: #059669; border-color: #a7f3d0; }
.action-btn.approve-btn:hover { background: #ecfdf5; border-color: #059669; }
.action-btn.flag-btn { color: #b45309; border-color: #fde68a; }
.action-btn.flag-btn:hover { background: #fffbeb; border-color: #f59e0b; }

/* Review queue page */
.review-flag-card {
  border: 1px solid #fbbf24; border-radius: 6px;
  padding: 12px 16px; margin-bottom: 12px; background: #fffbeb;
}
.review-flag-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.review-flag-who { font-size: 12px; color: #78716c; }
.review-flag-label { font-weight: 600; margin-bottom: 4px; }
.review-flag-desc { color: #57534e; font-size: 13px; margin-bottom: 6px; }
.review-flag-note { font-size: 12px; color: #b45309; font-style: italic; margin-bottom: 8px; }
.review-flag-vendor { font-size: 12px; color: #6b7280; margin-bottom: 8px; }
.review-desc { max-width: 400px; font-size: 12px; color: #4b5563; }
.review-approved { opacity: 0.4; pointer-events: none; }
.col-right { text-align: right; }
.btn-sm {
  font-size: 12px; padding: 3px 10px; border-radius: 4px;
  border: 1px solid #e5e7eb; cursor: pointer; background: white;
  color: #374151; transition: background 0.15s;
}
.btn-sm:hover { background: #f9fafb; }
.btn-approve { color: #059669; border-color: #a7f3d0; }
.btn-approve:hover { background: #ecfdf5; border-color: #059669; }

/* People group header rows */
.people-group-header td {
  background: #f8fafc; color: #6b7280; font-size: 11px;
  font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 12px; border-top: 1px solid #e5e7eb;
}

/* Emerging vendors legend */
.emerging-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 14px 16px; margin-bottom: 16px;
}
.emerging-legend-item {
  flex: 1 1 220px; display: flex; flex-direction: column; gap: 3px;
}
.emerging-legend-action {
  font-size: 12px; font-weight: 700; color: #374151; letter-spacing: 0.02em;
}
.emerging-legend-desc {
  font-size: 12px; color: #6b7280; line-height: 1.4;
}

/* Event vendor action cell */
.ev-action-cell { white-space: nowrap; }

/* Event vendor match confidence badges */
.match-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  border-radius: 8px; padding: 1px 6px; margin-right: 4px;
  vertical-align: middle; letter-spacing: 0.02em;
}
.match-exact    { background: #dcfce7; color: #166534; }
.match-alias    { background: #dbeafe; color: #1e40af; }
.match-prefix   { background: #fef3c7; color: #92400e; }
.match-unmatched { background: #fee2e2; color: #991b1b; }

/* Raw name hint below matched vendor name */
.ev-raw-name { font-size: 11px; color: #9ca3af; margin-top: 1px; }
.ev-raw-name-main { font-weight: 600; color: #374151; }

/* Unmatched event vendor row */
.ev-unmatched-row td { background: #fff7f7; }

/* Assign input row */
.ev-assign-row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.ev-assign-input { font-size: 12px; border: 1px solid #d1d5db; border-radius: 4px; padding: 3px 8px; width: 180px; }

/* Edit / Reject action buttons */
.action-btn.edit-btn { color: #2563eb; border-color: #bfdbfe; }
.action-btn.edit-btn:hover { background: #eff6ff; border-color: #2563eb; }
.action-btn.reject-btn { color: #dc2626; border-color: #fecaca; font-size: 11px; }
.action-btn.reject-btn:hover { background: #fef2f2; border-color: #dc2626; }

/* Enrichment edit modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal-box { background: white; border-radius: 10px; padding: 24px 28px; width: 500px; max-width: 95vw; box-shadow: 0 12px 40px rgba(0,0,0,0.2); }
.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 18px; }
.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.modal-field input[type="text"],
.modal-field input[type="number"],
.modal-field textarea,
.modal-field select { width: 100%; border: 1px solid #d1d5db; border-radius: 5px; padding: 6px 10px; font-size: 13px; box-sizing: border-box; font-family: inherit; }
.modal-field textarea { resize: vertical; min-height: 70px; }
.modal-field-check { display: flex; align-items: center; gap: 8px; }
.modal-field-check label { font-size: 13px; font-weight: 400; margin: 0; color: #374151; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-modal-cancel { background: none; border: 1px solid #e5e7eb; border-radius: 5px; padding: 6px 16px; cursor: pointer; font-size: 13px; color: #6b7280; }
.btn-modal-cancel:hover { background: #f9fafb; }
.btn-modal-save { background: #2563eb; color: white; border: none; border-radius: 5px; padding: 6px 16px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn-modal-save:hover { background: #1d4ed8; }

/* Review queue edit/reject variants */
.btn-sm.btn-reject { color: #dc2626; border-color: #fecaca; }
.btn-sm.btn-reject:hover { background: #fef2f2; border-color: #dc2626; }
.btn-sm.btn-edit { color: #2563eb; border-color: #bfdbfe; }
.btn-sm.btn-edit:hover { background: #eff6ff; border-color: #2563eb; }

