:root {
  --fg: #1a1a1a;
  --bg: #fafafa;
  --muted: #666;
  --border: #e0e0e0;
  --brand: #0b5cad;
  --accent: #0b5cad;
  --error: #b30016;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: white;
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 600; color: var(--brand); text-decoration: none; }
.topbar nav { display: flex; gap: 1rem; flex: 1; }
.topbar nav a { color: var(--fg); text-decoration: none; }
.topbar nav a:hover { color: var(--brand); }
.topbar .user { color: var(--muted); font-size: 0.9rem; display: flex; gap: 0.75rem; align-items: center; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.bottombar { text-align: center; padding: 1rem; color: var(--muted); }

.card { background: white; border: 1px solid var(--border); padding: 1.5rem; border-radius: 8px; max-width: 480px; margin: 4rem auto; }

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--brand);
  color: white;
  border: 0;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}
.btn:hover { filter: brightness(1.1); }

.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; }
.inline { display: inline; }

.error { color: var(--error); }
.muted { color: var(--muted); font-size: 0.9rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.stat { display: block; padding: 1rem; background: white; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--fg); }
.stat-num { font-size: 2rem; font-weight: 600; color: var(--brand); }
.stat-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

.rfp-table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--border); }
.rfp-table th, .rfp-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.rfp-table th { background: #f4f4f4; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.rfp-table tr:last-child td { border-bottom: 0; }
.rfp-table a { color: var(--brand); text-decoration: none; }
.rfp-table a:hover { text-decoration: underline; }

.tag { display: inline-block; padding: 0.15rem 0.5rem; background: #eef4fb; color: var(--brand); border-radius: 999px; font-size: 0.8rem; margin-right: 0.25rem; }

pre.content { white-space: pre-wrap; background: white; border: 1px solid var(--border); padding: 1rem; border-radius: 4px; max-height: 400px; overflow: auto; }

.decision { display: flex; flex-direction: column; gap: 0.75rem; max-width: 640px; }
.decision label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
.decision input[type=text], .decision input[type=url], .decision input[type=email], .decision input[type=password], .decision select, .decision textarea {
  padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font: inherit;
}
.decision textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.row-checkbox { flex-direction: row !important; align-items: center; gap: 0.5rem !important; }
.row-checkbox input { width: auto; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.form-actions { display: flex; gap: 0.5rem; }
.btn-secondary { background: white; color: var(--brand); border: 1px solid var(--brand); }

.preview { margin-top: 1.5rem; padding: 1rem; background: white; border: 1px solid var(--border); border-radius: 6px; max-width: 640px; }
.preview ol { padding-left: 1.25rem; }
.preview li { margin-bottom: 0.5rem; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; align-items: center; }
.filter-bar input, .filter-bar select { padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.filter-bar input[type=search] { flex: 1; min-width: 200px; }

.tags-row { margin: 0.25rem 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }

.relevance { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-variant-numeric: tabular-nums; font-weight: 600; }
.relevance[data-score^="0.8"], .relevance[data-score^="0.9"], .relevance[data-score="1.00"] { background: #d4edda; color: #155724; }
.relevance[data-score^="0.6"], .relevance[data-score^="0.7"] { background: #fff3cd; color: #856404; }
.relevance[data-score^="0.0"], .relevance[data-score^="0.1"], .relevance[data-score^="0.2"], .relevance[data-score^="0.3"] { background: #f8d7da; color: #721c24; }

.ai-block { background: white; border: 1px solid var(--border); border-left: 3px solid var(--brand); padding: 1rem 1.25rem; border-radius: 4px; margin: 1rem 0; }
.ai-block h2 { margin-top: 0; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0.5rem 0; }
dl.kv dt { color: var(--muted); font-size: 0.85rem; }
dl.kv dd { margin: 0; font-weight: 500; }

.mentions { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.5rem 0; }
.mention { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 0.8rem; }
.mention.on { background: #e8f4ff; color: var(--brand); font-weight: 600; }
.mention.off { background: #f3f3f3; color: #aaa; text-decoration: line-through; }

.quick-decide { white-space: nowrap; }
.quick-decide button {
  width: 2rem; height: 2rem; padding: 0; margin-right: 0.25rem;
  border: 1px solid var(--border); background: white; border-radius: 4px; cursor: pointer; font-weight: 600;
}
.quick-decide button:hover { background: #f4f4f4; }
.quick-decide button[data-verdict=pursue] { color: #2a7a2a; border-color: #2a7a2a; }
.quick-decide button[data-verdict=maybe]  { color: #8a6d00; border-color: #d6a700; }
.quick-decide button[data-verdict=pass]   { color: #b30016; border-color: #b30016; }
.quick-decide button[data-verdict=pursue]:hover { background: #e8f5e8; }
.quick-decide button[data-verdict=maybe]:hover  { background: #fff7e0; }
.quick-decide button[data-verdict=pass]:hover   { background: #fde8e8; }

.rfp-table tr.saving { opacity: 0.6; }
.rfp-table tr.decided { background: #f6fff6; }
.rfp-table tr.decided[data-decided-as=pass]   { background: #fff6f6; }
.rfp-table tr.decided[data-decided-as=maybe]  { background: #fffbf0; }
.rfp-table tr.error { background: #fff0f0; }

.dashboard h2 { margin-top: 2rem; }
.dashboard h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin: 1rem 0 0; }
.kpi { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; }
.kpi-num { font-size: 2.25rem; font-weight: 700; color: var(--brand); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.25rem; }

.legend { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.75rem 0 1.5rem; font-size: 0.9rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; color: var(--fg); }
.legend-item:hover { color: var(--brand); }
.legend-item .dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; }

.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1.5rem; margin: 1.5rem 0; }
.chart-card { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; }
.chart-card svg { width: 100%; height: auto; }

.empty { background: white; border: 1px dashed var(--border); border-radius: 8px; padding: 2rem; text-align: center; margin: 2rem 0; }
.empty h2 { margin-top: 0; }

.small { font-size: 0.8rem; }

/* Mobile */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.6rem 0.75rem; }
  .topbar nav { gap: 0.75rem; flex-basis: 100%; order: 3; overflow-x: auto; padding-bottom: 0.25rem; -webkit-overflow-scrolling: touch; }
  .topbar nav a { white-space: nowrap; }
  .topbar .user { font-size: 0.85rem; }

  main { padding: 1rem 0.75rem; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .filter-bar input[type=search] { min-width: 0; }

  .rfp-table { font-size: 0.85rem; }
  .rfp-table th, .rfp-table td { padding: 0.4rem 0.5rem; }
  .rfp-table { display: block; overflow-x: auto; }

  .kpi { padding: 1rem; }
  .kpi-num { font-size: 1.75rem; }

  .charts-grid { grid-template-columns: 1fr; gap: 1rem; }

  .quick-decide button { width: 1.75rem; height: 1.75rem; }
}
