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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f5f4f0;
  color: #1a1a1a;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Header ── */
.header {
  background: #fff;
  border-bottom: 1px solid #e8e5de;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 18px; font-weight: 600; }
.tagline { font-size: 13px; color: #999; }
.header-right { display: flex; align-items: center; gap: 8px; }
.conn-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: #f0ede8;
  color: #888;
}
.conn-status.connected { background: #e8f5ee; color: #1a7a45; }
.conn-status.demo { background: #f0f4ff; color: #3b5bdb; }

/* ── Buttons ── */
.btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #d0cdc8;
  background: #fff;
  color: #1a1a1a;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: #f5f4f0; border-color: #b0ada8; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn-primary:hover { background: #2d2d2d; border-color: #2d2d2d; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Setup panel ── */
.setup-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 57px);
  padding: 2rem 1rem;
}
.setup-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8e5de;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
}
.setup-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 0.5rem; }
.setup-card > p { font-size: 14px; color: #666; margin-bottom: 1.5rem; line-height: 1.6; }
.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-size: 12px; font-weight: 500; color: #666; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-row input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d0cdc8;
  border-radius: 8px;
  font-size: 14px;
  background: #fafaf8;
  color: #1a1a1a;
  transition: border-color 0.12s, background 0.12s;
}
.form-row input:focus { outline: none; border-color: #1a1a1a; background: #fff; }
.setup-actions { display: flex; gap: 8px; margin-top: 1.25rem; }
.setup-note { font-size: 12px; color: #aaa; margin-top: 1rem; line-height: 1.5; }

/* ── App panel ── */
.app-panel { padding: 1.5rem; max-width: 960px; margin: 0 auto; }
.hidden { display: none !important; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid #e8e5de; margin-bottom: 1.5rem; }
.tab {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  color: #999;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s;
}
.tab:hover { color: #555; }
.tab.active { color: #1a1a1a; border-bottom-color: #1a1a1a; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8e5de;
  padding: 1rem 1.25rem;
}
.stat-label { font-size: 12px; color: #999; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 600; color: #1a1a1a; }
.stat-value.urgent { color: #c0392b; }
.stat-value.soon { color: #b07800; }
.stat-value.ok { color: #1a7a45; }

/* ── Controls ── */
.controls {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.controls input, .controls select {
  padding: 7px 10px;
  border: 1px solid #d0cdc8;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: #1a1a1a;
}
.controls input { flex: 1; min-width: 180px; }
.controls select { min-width: 130px; }
.spacer { flex: 1; }
.section-title {
  font-size: 12px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* ── Source cards ── */
.source-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 2rem; }
.source-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8e5de;
  border-left: 4px solid #e8e5de;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.12s;
}
.source-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.source-card.urgent { border-left-color: #e74c3c; }
.source-card.soon { border-left-color: #f0a500; }
.source-card.unknown { border-left-color: #ccc; }
.source-card.ok { border-left-color: #27ae60; }
.source-card.added { border-left-color: #27ae60; background: #fafffc; }

.source-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: #f5f4f0;
}
.source-body { flex: 1; min-width: 0; }
.source-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.source-meta { font-size: 12px; color: #999; margin-bottom: 6px; }
.source-meta a { color: #3b5bdb; text-decoration: none; }
.source-meta a:hover { text-decoration: underline; }
.source-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #f0ede8;
  color: #666;
  font-weight: 500;
}
.tag.type-accelerator { background: #ede9ff; color: #5c3fd1; }
.tag.type-fellowship { background: #e0f5ee; color: #0d6e50; }
.tag.type-competition { background: #fff3e0; color: #a05c00; }
.tag.type-grant { background: #fde8e8; color: #a03030; }
.tag.type-event { background: #e3f0ff; color: #1a5faa; }
.tag.type-vc { background: #fce8f4; color: #8a2060; }

.source-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  flex-shrink: 0;
}
.days-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.days-badge.urgent { background: #fff0ee; color: #c0392b; }
.days-badge.soon { background: #fff8e0; color: #b07800; }
.days-badge.unknown { background: #f0ede8; color: #888; }
.days-badge.ok { background: #e8f5ee; color: #1a7a45; }
.days-badge.added { background: #e8f5ee; color: #1a7a45; }
.added-label { font-size: 11px; color: #1a7a45; font-weight: 500; }

/* ── Calendar ── */
.calendar-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8e5de;
  padding: 1.5rem;
}
.cal-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}
.cal-title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.cal-nav {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #d0cdc8;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.cal-nav:hover { background: #f5f4f0; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day-label {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 0 8px;
}
.cal-cell {
  min-height: 72px;
  border-radius: 8px;
  padding: 5px;
  border: 1px solid transparent;
  font-size: 11px;
}
.cal-cell.other-month { opacity: 0.3; }
.cal-cell.today { border-color: #1a1a1a; background: #fafaf8; }
.cal-date { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.cal-event {
  border-radius: 4px;
  padding: 1px 5px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  background: #ede9ff;
  color: #5c3fd1;
}
.cal-event.urgent { background: #fff0ee; color: #c0392b; }
.cal-event.soon { background: #fff8e0; color: #b07800; }
.cal-event.ok { background: #e8f5ee; color: #1a7a45; }
.cal-more { font-size: 10px; color: #aaa; padding: 1px 5px; }

/* ── Agent ── */
.agent-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8e5de;
  padding: 1.5rem;
  margin-bottom: 12px;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.agent-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.agent-body { flex: 1; }
.agent-body h3 { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.agent-body p { font-size: 13px; color: #666; margin-bottom: 12px; line-height: 1.6; }
.agent-result {
  display: none;
  margin-top: 12px;
  background: #f5f4f0;
  border-radius: 10px;
  padding: 1rem;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  border: 1px solid #e8e5de;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 999;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #aaa;
  font-size: 14px;
}

@media (max-width: 640px) {
  .header { padding: 0.75rem 1rem; }
  .tagline { display: none; }
  .app-panel { padding: 1rem; }
  .source-card { flex-wrap: wrap; }
  .source-actions { flex-direction: row; width: 100%; justify-content: space-between; }
}

/* ── Discovery suggestion cards ── */
.suggestion-card {
  background: #fafaf8;
  border: 1px solid #e8e5de;
  border-left: 4px solid #3b5bdb;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.suggestion-card.accepted { border-left-color: #27ae60; background: #f0faf4; opacity: 0.6; }
.suggestion-card.rejected { display: none; }
.suggestion-body { flex: 1; min-width: 0; }
.suggestion-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.suggestion-meta { font-size: 12px; color: #999; margin-bottom: 5px; }
.suggestion-meta a { color: #3b5bdb; text-decoration: none; }
.suggestion-reason { font-size: 13px; color: #555; line-height: 1.5; margin-bottom: 8px; }
.suggestion-actions { display: flex; gap: 6px; }
.btn-accept { background: #1a7a45; color: #fff; border-color: #1a7a45; }
.btn-accept:hover { background: #145e35; }
.btn-reject { background: #fff; color: #999; border-color: #d0cdc8; }
.btn-reject:hover { background: #f5f4f0; color: #c0392b; border-color: #c0392b; }
