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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: #1a365d;
}

/* App Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 1rem;
}

.app-header h1 {
  margin-bottom: 0;
}

.settings-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: #e2e8f0;
  border: none;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.settings-btn:hover {
  background: #cbd5e0;
}

.settings-btn svg {
  color: #4a5568;
}

.section {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.section h2 {
  margin-bottom: 1rem;
  color: #2d3748;
  font-size: 1.1rem;
}

/* Collapsible Sections */
.section.collapsible .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 0.5rem 0;
  margin: -0.5rem 0 0 0;
}

.section.collapsible .section-header:hover {
  background: #f7fafc;
  margin-left: -1rem;
  margin-right: -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.section.collapsible .section-header h2 {
  margin-bottom: 0;
}

.toggle-icon {
  font-size: 0.8rem;
  color: #718096;
  transition: transform 0.2s;
}

.section.collapsible.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.section.collapsible .section-content {
  transition: max-height 0.3s ease-out, opacity 0.2s ease-out, padding 0.3s ease-out;
  max-height: none;
  opacity: 1;
  overflow: visible;
  padding-top: 1rem;
}

.section.collapsible.collapsed .section-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
}

.hidden {
  display: none !important;
}

/* Autocomplete */
.input-group {
  display: flex;
  gap: 0.5rem;
}

.autocomplete-wrapper {
  position: relative;
  flex: 1;
}

#state-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#state-input:focus {
  border-color: #4299e1;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0 0 6px 6px;
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.autocomplete-list.active {
  display: block;
}

.autocomplete-list li {
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.autocomplete-list li:hover,
.autocomplete-list li.highlighted {
  background: #ebf8ff;
}

/* Buttons */
button {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#search-districts-btn,
#find-contacts-btn {
  background: #4299e1;
  color: #fff;
}

#search-districts-btn:hover:not(:disabled),
#find-contacts-btn:hover:not(:disabled) {
  background: #3182ce;
}

#export-csv-btn {
  background: #48bb78;
  color: #fff;
  margin-bottom: 1rem;
}

#export-csv-btn:hover {
  background: #38a169;
}

.refresh-btn {
  background: #ed8936;
  color: #fff;
}

.refresh-btn:hover:not(:disabled) {
  background: #dd6b20;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.toolbar button {
  background: #e2e8f0;
  color: #4a5568;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
}

.toolbar button:hover:not(:disabled) {
  background: #cbd5e0;
}

.toolbar .refresh-btn {
  background: #ed8936;
  color: #fff;
}

.toolbar .refresh-btn:hover:not(:disabled) {
  background: #dd6b20;
}

.title-filter-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  font-size: 0.85rem;
  color: #4a5568;
}

.title-filter-wrap select {
  padding: 0.3rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 0.82rem;
  background: #fff;
  max-width: 200px;
}

.contacts-count {
  color: #718096;
  font-size: 0.82rem;
  white-space: nowrap;
}

.group-section-header {
  cursor: pointer;
  background: #f0f4f8;
}

.group-section-header td {
  font-weight: 600;
  font-size: 0.85rem;
  color: #4a5568;
  padding: 0.5rem 0.75rem;
  border-top: 2px solid #e2e8f0;
}

.group-section-header:hover td {
  background: #e2e8f0;
}

.group-toggle-icon {
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.7rem;
}

tr[class*="group-row-"].hidden {
  display: none;
}

tr[class*="group-row-"] {
  opacity: 0.85;
}

#district-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: #718096;
}

.cache-indicator {
  background: #c6f6d5;
  color: #276749;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
}

/* District list */
.districts-list {
  max-height: 350px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.district-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid #f0f0f0;
}

.district-item:last-child {
  border-bottom: none;
}

.district-item label {
  flex: 1;
  cursor: pointer;
  margin-left: 0.5rem;
}

.district-item .city {
  color: #a0aec0;
  font-size: 0.85rem;
  margin-left: 0.3rem;
}

.clear-district-btn {
  background: none;
  border: none;
  color: #cbd5e0;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.4rem;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}

.clear-district-btn:hover {
  color: #e53e3e;
  background: #fff5f5;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: #edf2f7;
  text-align: left;
  padding: 0.6rem 0.5rem;
  font-weight: 600;
  color: #4a5568;
  white-space: nowrap;
}

td {
  padding: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
  word-break: break-word;
}

td a {
  color: #4299e1;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

/* Status bar */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #2d3748;
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 100;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Agent Status Panel */
.agent-status-panel {
  background: #edf2f7;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.agent-status-panel h4 {
  margin-bottom: 0.5rem;
  color: #2d3748;
  font-size: 0.9rem;
}

.agent-legend {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: #718096;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.legend-item .provider-icon {
  width: 8px;
  height: 8px;
}

.legend-item .provider-icon.claude {
  background: #4299e1;
}

.legend-item .provider-icon.codex {
  background: #48bb78;
}

.legend-item .provider-icon.orchestrator {
  background: #9f7aea;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
}

.agent-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 0.85rem;
}

.agent-item .agent-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #a0aec0;
}

.agent-item.pending .agent-icon {
  background: #a0aec0;
}

.agent-item.starting .agent-icon {
  background: #4299e1;
  animation: pulse 1s infinite;
}

.agent-item.completed .agent-icon {
  background: #48bb78;
}

.agent-item.error .agent-icon {
  background: #e53e3e;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.agent-item .agent-name {
  flex: 1;
  color: #4a5568;
}

.agent-item .agent-status {
  font-size: 0.75rem;
  color: #718096;
}

.agent-item.completed .agent-status {
  color: #48bb78;
}

.agent-item.error .agent-status {
  color: #e53e3e;
}

/* State RFPs Section */
.state-rfps-section {
  background: #fffaf0;
  border: 1px solid #fbd38d;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.state-rfps-section h3 {
  color: #c05621;
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* Insight Cards */
.insight-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.insight-card:last-child {
  margin-bottom: 0;
}

.insight-title {
  color: #1a365d;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #4299e1;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.insight-stat {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
}

.insight-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.insight-section h4 {
  font-size: 0.9rem;
  color: #4a5568;
  margin-bottom: 0.5rem;
}

.insight-section ul {
  list-style: none;
  padding-left: 0;
}

.insight-section li {
  padding: 0.5rem 0;
  padding-left: 1rem;
  position: relative;
}

.insight-section li::before {
  content: "";
  color: #4299e1;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.insight-section li p {
  color: #718096;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.budget-notes {
  background: #ebf8ff;
  border: 1px solid #bee3f8;
  border-radius: 6px;
  padding: 0.75rem;
}

.budget-notes p {
  color: #2b6cb0;
  margin: 0;
  font-size: 0.85rem;
}

.project-list .timeline {
  color: #48bb78;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.keywords {
  display: inline-block;
  background: #e2e8f0;
  color: #4a5568;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.5rem;
}

/* Technologies */
.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.tech-category {
  background: #ebf8ff;
  color: #2b6cb0;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
}

.tech-name {
  font-weight: 500;
  color: #2d3748;
}

.tech-notes {
  color: #718096;
  font-size: 0.8rem;
}

/* Board Meetings */
.meeting-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.meeting-date {
  background: #edf2f7;
  color: #718096;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* RFPs */
.rfp-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rfp-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem;
}

.rfp-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.rfp-type {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.rfp-type.rfp {
  background: #fed7d7;
  color: #c53030;
}

.rfp-type.grant {
  background: #c6f6d5;
  color: #276749;
}

.rfp-type.funding {
  background: #bee3f8;
  color: #2b6cb0;
}

.rfp-deadline {
  background: #fbd38d;
  color: #744210;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-left: auto;
}

.rfp-desc {
  color: #718096;
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.rfp-link {
  color: #4299e1;
  text-decoration: none;
  font-size: 0.85rem;
}

.rfp-link:hover {
  text-decoration: underline;
}

/* Challenges */
.challenges-section {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 6px;
  padding: 1rem;
}

.challenges-section h4 {
  color: #c53030;
}

.challenge-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid #fed7d7;
}

.challenge-list li:last-child {
  border-bottom: none;
}

.challenge-category {
  background: #fed7d7;
  color: #c53030;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.challenge-desc {
  color: #742a2a;
  flex: 1;
}

.challenge-source {
  color: #a0aec0;
  font-size: 0.75rem;
}

.challenge-year {
  background: #fed7d7;
  color: #c53030;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  margin-right: 0.5rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background: #ebf8ff;
  color: #2b6cb0;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.prospecting-notes {
  background: #fffaf0;
  border: 1px solid #fbd38d;
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
}

.prospecting-notes h4 {
  color: #c05621;
}

.prospecting-notes p {
  color: #744210;
  margin: 0;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #1a365d;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #718096;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.close-btn:hover {
  color: #2d3748;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

.settings-section {
  margin-bottom: 1.5rem;
}

.settings-section:last-child {
  margin-bottom: 0;
}

/* Danger zone in settings */
.settings-danger {
  border: 1px solid #feb2b2;
  border-radius: 6px;
  padding: 1rem;
  background: #fff5f5;
}

.settings-danger h3 {
  color: #c53030;
}

.danger-text {
  font-size: 0.85rem;
  color: #742a2a;
  margin-bottom: 0.8rem;
  line-height: 1.5;
}

.danger-btn {
  background: #e53e3e;
  color: #fff;
  border: none;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s;
}

.danger-btn:hover:not(:disabled) {
  background: #c53030;
}

.danger-btn:disabled {
  background: #feb2b2;
  cursor: not-allowed;
}

/* Clear DB confirmation modal */
.modal-narrow {
  max-width: 460px;
}

.modal-header-danger {
  background: #fff5f5;
  border-bottom-color: #feb2b2;
}

.modal-header-danger h2 {
  color: #c53030;
}

.danger-warning {
  text-align: left;
}

.danger-warning p {
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
  color: #2d3748;
}

.danger-warning ul {
  margin: 0.5rem 0 1rem 1.5rem;
  font-size: 0.88rem;
  color: #4a5568;
}

.danger-warning ul li {
  margin-bottom: 0.3rem;
}

.confirm-input-wrap {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.confirm-input-wrap label {
  display: block;
  font-size: 0.85rem;
  color: #4a5568;
  margin-bottom: 0.4rem;
}

.confirm-input-wrap input {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 1rem;
  letter-spacing: 2px;
  text-align: center;
}

.confirm-input-wrap input:focus {
  outline: none;
  border-color: #e53e3e;
}

.modal-footer .cancel-btn {
  background: #e2e8f0;
  color: #4a5568;
  border: none;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-right: 0.8rem;
}

.settings-section h3 {
  font-size: 0.85rem;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.setting-group {
  margin-bottom: 1rem;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-group label {
  display: block;
  font-size: 0.9rem;
  color: #4a5568;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.setting-group textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}

.setting-group textarea:focus {
  outline: none;
  border-color: #4299e1;
}

.save-btn {
  background: #4299e1;
  color: #fff;
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.save-btn:hover {
  background: #3182ce;
}

/* Source Link */
.source-link {
  color: #4299e1;
  font-size: 0.8rem;
  margin-left: 0.5rem;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

/* Insight Item Collapsible */
.insight-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: 4px;
}

.insight-item-header:hover {
  background: #f0f4f8;
}

.insight-item-toggle {
  font-size: 0.7rem;
  color: #718096;
  transition: transform 0.2s;
}

.insight-item.collapsed .insight-item-toggle {
  transform: rotate(-90deg);
}

.insight-item.collapsed .insight-item-content {
  display: none;
}

/* Insight Header with Refresh Button */
.insight-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  cursor: pointer;
}

.insight-header-left h4 {
  margin: 0;
}

/* Refresh Section Button */
.refresh-section-btn {
  background: none;
  border: 1px solid #cbd5e0;
  color: #718096;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition: all 0.2s;
}

.refresh-section-btn:hover:not(:disabled) {
  background: #ed8936;
  border-color: #ed8936;
  color: #fff;
}

.refresh-section-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Enrollment section refresh */
.enrollment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.enrollment-title {
  font-weight: 600;
  color: #4a5568;
}

/* Grouped RFP Sections */
.rfp-group {
  margin-bottom: 1rem;
}

.rfp-group:last-child {
  margin-bottom: 0;
}

.rfp-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f7fafc;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.5rem;
}

.rfp-group-header:hover {
  background: #edf2f7;
}

.rfp-group-toggle {
  font-size: 0.7rem;
  color: #718096;
  transition: transform 0.2s;
}

.rfp-group.collapsed .rfp-group-toggle {
  transform: rotate(-90deg);
}

.rfp-group.collapsed .rfp-group-content {
  display: none;
}

.rfp-group-title {
  font-weight: 600;
  color: #4a5568;
  font-size: 0.9rem;
}

.rfp-group-count {
  background: #e2e8f0;
  color: #718096;
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
}

/* Challenge Groups */
.challenge-group {
  margin-bottom: 1rem;
}

.challenge-group:last-child {
  margin-bottom: 0;
}

.challenge-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #fff5f5;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.5rem;
}

.challenge-group-header:hover {
  background: #fed7d7;
}

.challenge-group-toggle {
  font-size: 0.7rem;
  color: #c53030;
  transition: transform 0.2s;
}

.challenge-group.collapsed .challenge-group-toggle {
  transform: rotate(-90deg);
}

.challenge-group.collapsed .challenge-group-content {
  display: none;
}

.challenge-group-title {
  font-weight: 600;
  color: #c53030;
  font-size: 0.9rem;
}

.challenge-group-count {
  background: #fed7d7;
  color: #c53030;
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
}

/* RFP Type Colors for Bid */
.rfp-type.bid {
  background: #e9d8fd;
  color: #553c9a;
}

/* ============================================
   SOURCE BADGES - Claude/Codex/Both
   ============================================ */
.source-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.source-badge.claude {
  background: #c6d4ff;
  color: #2c5aa0;
}

.source-badge.codex {
  background: #c6ffe0;
  color: #1a7a3e;
}

.source-badge.both {
  background: linear-gradient(135deg, #c6d4ff 50%, #c6ffe0 50%);
  color: #2d4a6a;
}

/* ============================================
   CONFIDENCE INDICATOR
   ============================================ */
.confidence-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.confidence-bar {
  width: 40px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.confidence-fill.high {
  background: #48bb78;
}

.confidence-fill.medium {
  background: #ecc94b;
}

.confidence-fill.low {
  background: #f56565;
}

.confidence-label {
  font-size: 0.7rem;
  color: #718096;
  font-weight: 500;
}

/* ============================================
   CONFLICT MARKER
   ============================================ */
.conflict-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #fed7d7;
  color: #c53030;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: bold;
  margin-left: 0.3rem;
  cursor: help;
}

/* ============================================
   VALUE WITH METADATA
   ============================================ */
.value-with-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem;
}

/* ============================================
   SOURCE BREAKDOWN
   ============================================ */
.source-breakdown {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.source-count {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.source-count.both {
  background: linear-gradient(135deg, #c6d4ff 50%, #c6ffe0 50%);
  color: #2d4a6a;
}

.source-count.claude {
  background: #c6d4ff;
  color: #2c5aa0;
}

.source-count.codex {
  background: #c6ffe0;
  color: #1a7a3e;
}

/* ============================================
   CONFLICTS SUMMARY
   ============================================ */
.conflicts-summary {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 6px;
  padding: 0.75rem;
  margin-top: 1rem;
}

.conflicts-summary h4 {
  color: #c53030;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.conflicts-summary ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.conflicts-summary li {
  font-size: 0.85rem;
  color: #742a2a;
  padding: 0.25rem 0;
}

/* ============================================
   VERIFICATION SUMMARY
   ============================================ */
.verification-summary {
  background: #f0fff4;
  border: 1px solid #9ae6b4;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.verification-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.verification-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.verification-stat .stat-label {
  font-size: 0.7rem;
  color: #718096;
  text-transform: uppercase;
}

.verification-stat .stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #276749;
}

.verification-stat .stat-value.has-conflicts {
  color: #c53030;
}

.verification-warning {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #9ae6b4;
  font-size: 0.85rem;
  color: #c05621;
}

/* ============================================
   DUAL PROVIDER ICONS IN AGENT STATUS
   ============================================ */
.agent-item .provider-icons {
  display: flex;
  gap: 4px;
  margin-right: 0.5rem;
}

.provider-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a0aec0;
}

.provider-icon.claude {
  background: #a0aec0;
}

.provider-icon.codex {
  background: #a0aec0;
}

.provider-icon.pending {
  background: #a0aec0;
}

.provider-icon.running {
  animation: pulse 1s infinite;
}

.provider-icon.claude.running {
  background: #4299e1;
}

.provider-icon.codex.running {
  background: #48bb78;
}

.provider-icon.claude.done {
  background: #48bb78;  /* Green when done */
}

.provider-icon.codex.done {
  background: #48bb78;  /* Green when done */
}

.provider-icon.orchestrator {
  background: #a0aec0;
}

.provider-icon.orchestrator.running {
  background: #9f7aea;  /* Purple when running */
  animation: pulse 1s infinite;
}

.provider-icon.orchestrator.done {
  background: #48bb78;  /* Green when done */
}

.provider-icon.error {
  background: #e53e3e;
}

/* Agent partial status (one provider succeeded) */
.agent-item.partial .agent-icon {
  background: #ecc94b;
}

.agent-item.partial .agent-status {
  color: #b7791f;
}

/* ============================================
   INSIGHT HEADER WITH CONFIDENCE
   ============================================ */
.insight-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #4299e1;
}

.insight-header .insight-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* ============================================
   ITEM HEADER ROW (for projects, etc.)
   ============================================ */
.item-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================
   CONTACT TABLE WITH SOURCES
   ============================================ */
#contacts-table tr.has-conflict {
  background: #fff5f5;
}

#contacts-table tr.has-conflict:hover {
  background: #fed7d7;
}

#contacts-table td .source-badge {
  margin-left: 0.25rem;
}

/* Source breakdown in toolbar */
.toolbar .source-breakdown {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

/* ============================================
   KILL/STOP ALL BUTTON
   ============================================ */
.kill-btn {
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  transition: background 0.2s, transform 0.1s;
}

.kill-btn:hover {
  background: #c53030;
  transform: scale(1.02);
}

.kill-btn:active {
  transform: scale(0.98);
}

.kill-btn svg {
  width: 14px;
  height: 14px;
}

.status-bar .kill-btn {
  margin-left: auto;
}

/* ============================================
   EMAIL/PHONE CONFLICT DISPLAY
   ============================================ */
.email-conflict,
.phone-conflict {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.email-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.email-conflict a,
.phone-conflict div {
  font-size: 0.85rem;
}

/* ============================================
   SOURCE LINK DISPLAY
   ============================================ */
.source-link-btn {
  background: #e2e8f0;
  color: #4a5568;
  border: none;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  cursor: pointer;
  margin-left: 0.5rem;
  transition: background 0.2s;
}

.source-link-btn:hover {
  background: #cbd5e0;
}

.insight-item-source {
  margin-left: auto;
  font-size: 0.75rem;
}

.insight-item-source a {
  color: #4299e1;
  text-decoration: none;
}

.insight-item-source a:hover {
  text-decoration: underline;
}

/* ============================================
   SECONDARY TITLE (Task 1)
   ============================================ */
.title2 {
  color: #718096;
  font-size: 0.8rem;
  font-style: italic;
}

/* ============================================
   FIT SCORE & TIER (Task 5)
   ============================================ */
.fit-score-panel {
  background: #f0fff4;
  border: 1px solid #9ae6b4;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.fit-score-panel h4 {
  color: #276749;
  margin-bottom: 0.75rem;
}

.fit-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.75rem;
}

.fit-score-card {
  background: #fff;
  border-radius: 8px;
  padding: 0.75rem;
  border-left: 4px solid #a0aec0;
}

.fit-score-card.tier-1 { border-left-color: #e53e3e; background: #fff5f5; }
.fit-score-card.tier-2 { border-left-color: #ed8936; background: #fffaf0; }
.fit-score-card.tier-3 { border-left-color: #ecc94b; background: #fffff0; }
.fit-score-card.tier-4 { border-left-color: #a0aec0; background: #f7fafc; }

.fit-score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.fit-district {
  font-weight: 600;
  color: #2d3748;
  font-size: 0.9rem;
}

.fit-score-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: #2d3748;
}

.fit-tier-label {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.tier-1 .fit-tier-label { background: #fed7d7; color: #c53030; }
.tier-2 .fit-tier-label { background: #feebc8; color: #c05621; }
.tier-3 .fit-tier-label { background: #fefcbf; color: #975a16; }
.tier-4 .fit-tier-label { background: #e2e8f0; color: #718096; }

.fit-reasons {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fit-reasons li {
  font-size: 0.75rem;
  color: #718096;
  padding: 0.1rem 0;
}

.fit-score-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.fit-score-badge.tier-1 { background: #fed7d7; color: #c53030; }
.fit-score-badge.tier-2 { background: #feebc8; color: #c05621; }
.fit-score-badge.tier-3 { background: #fefcbf; color: #975a16; }
.fit-score-badge.tier-4 { background: #e2e8f0; color: #718096; }

.fit-score-small {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  text-align: center;
  min-width: 30px;
}

.fit-score-small.tier-1 { background: #fed7d7; color: #c53030; }
.fit-score-small.tier-2 { background: #feebc8; color: #c05621; }
.fit-score-small.tier-3 { background: #fefcbf; color: #975a16; }
.fit-score-small.tier-4 { background: #e2e8f0; color: #718096; }

/* ============================================
   TAITO LEARNING SUMMARY (Task 2)
   ============================================ */
.taito-summary-section {
  margin-bottom: 1rem;
}

.taito-summary-card {
  background: #ebf8ff;
  border: 1px solid #90cdf4;
  border-radius: 8px;
  padding: 1rem;
}

.taito-summary-card h4 {
  color: #2b6cb0;
  margin-bottom: 0.75rem;
}

.taito-summary-card h5 {
  color: #2b6cb0;
  margin: 0.75rem 0 0.5rem;
  font-size: 0.9rem;
}

.taito-products {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.taito-product {
  background: #fff;
  border: 1px solid #bee3f8;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  flex: 1;
  min-width: 200px;
}

.taito-tag {
  display: inline-block;
  background: #bee3f8;
  color: #2b6cb0;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.5rem;
}

.taito-signals {
  list-style: none;
  padding: 0;
}

.taito-signals li {
  padding: 0.3rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid #bee3f8;
}

.taito-signals li:last-child {
  border-bottom: none;
}

.signal-competitor {
  color: #c53030;
  font-weight: 600;
}

.signal-keyword {
  color: #2b6cb0;
  font-weight: 600;
}

.signal-board {
  color: #805ad5;
  font-weight: 600;
}


.taito-no-signals {
  color: #718096;
  font-size: 0.85rem;
  font-style: italic;
}

/* ============================================
   ACTION BUTTONS (Tasks 6, 7, 9, 10)
   ============================================ */
.action-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.msg-btn {
  background: #4299e1;
  color: #fff;
}

.msg-btn:hover { background: #3182ce; }

.verify-btn {
  background: #9f7aea;
  color: #fff;
}

.verify-btn:hover:not(:disabled) { background: #805ad5; }

.apollo-btn {
  background: #667eea;
  color: #fff;
}

.apollo-btn:hover:not(:disabled) { background: #5a67d8; }

.summary-btn {
  background: #38b2ac;
  color: #fff;
}

.summary-btn:hover:not(:disabled) { background: #319795; }

/* Email status indicators */
.email-status {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.email-valid { background: #c6f6d5; color: #276749; }
.email-invalid { background: #fed7d7; color: #c53030; }
.email-uncertain { background: #fefcbf; color: #975a16; }

/* ============================================
   MESSAGE MODAL
   ============================================ */
.modal-wide {
  max-width: 700px;
}

.message-controls {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.message-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.message-control-group label {
  font-size: 0.8rem;
  color: #718096;
  font-weight: 500;
}

.message-control-group select {
  padding: 0.4rem 0.6rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s;
}

.message-control-group select:focus {
  outline: none;
  border-color: #4299e1;
}

.length-toggle {
  display: flex;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}

.length-btn {
  padding: 0.4rem 0.8rem;
  border: none;
  background: #f7fafc;
  color: #4a5568;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 0;
}

.length-btn.active {
  background: #4299e1;
  color: #fff;
}

.length-btn:hover:not(.active) {
  background: #edf2f7;
}

.generate-msg-btn {
  background: #4299e1;
  color: #fff;
  padding: 0.4rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.generate-msg-btn:hover {
  background: #3182ce;
}

.message-content {
  position: relative;
}

.message-loading {
  text-align: center;
  padding: 2rem;
  color: #718096;
}

.message-text,
.summary-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #2d3748;
  max-height: 400px;
  overflow-y: auto;
}

.message-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.copy-btn {
  background: #48bb78;
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.copy-btn:hover { background: #38a169; }

/* ============================================
   TOPIC CHECKBOXES (Task 8)
   ============================================ */
.topic-checkbox {
  margin-right: 0.5rem;
  cursor: pointer;
  vertical-align: middle;
}

.topic-checkbox:checked + span,
.topic-checkbox:checked ~ h4 {
  color: #2b6cb0;
}

/* ============================================
   SETTINGS ADDITIONS
   ============================================ */
.setting-group select,
.setting-group input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.setting-group select:focus,
.setting-group input[type="password"]:focus {
  outline: none;
  border-color: #4299e1;
}

/* ============================================
   SCORE RUBRIC
   ============================================ */
.rubric-btn {
  background: #667eea;
  color: #fff;
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background 0.2s;
}

.rubric-btn:hover { background: #5a67d8; }

.rubric-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.rubric-table th {
  background: #edf2f7;
  text-align: left;
  padding: 0.5rem;
  font-weight: 600;
  color: #4a5568;
}

.rubric-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  color: #2d3748;
}

.rubric-table tfoot td {
  border-top: 2px solid #4299e1;
  border-bottom: none;
}

.rubric-tiers {
  margin-top: 1rem;
}

.rubric-tiers h4 {
  margin-bottom: 0.5rem;
  color: #2d3748;
  font-size: 0.9rem;
}

.rubric-tier {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.rubric-tier.tier-1 { background: #fff5f5; color: #c53030; border-left: 4px solid #e53e3e; }
.rubric-tier.tier-2 { background: #fffaf0; color: #c05621; border-left: 4px solid #ed8936; }
.rubric-tier.tier-3 { background: #fffff0; color: #975a16; border-left: 4px solid #ecc94b; }
.rubric-tier.tier-4 { background: #f7fafc; color: #718096; border-left: 4px solid #a0aec0; }

/* ============================================
   SUMMARY TOOLBAR (bottom sticky bar)
   ============================================ */
.summary-toolbar {
  position: sticky;
  bottom: 0;
  background: #2d3748;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.summary-toolbar .summary-btn {
  background: #38b2ac;
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.summary-toolbar .summary-btn:hover:not(:disabled) {
  background: #319795;
}

.summary-toolbar .summary-btn:disabled {
  opacity: 0.6;
}

.selected-count {
  color: #a0aec0;
  font-size: 0.85rem;
}

/* ============================================
   AI-GENERATED TAITO SUMMARY
   ============================================ */
.taito-ai-summary {
  background: linear-gradient(135deg, #ebf4ff 0%, #e6fffa 100%);
  border: 1px solid #90cdf4;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.ai-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.ai-summary-header-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.ai-collapse-btn {
  background: none;
  border: none;
  color: #4a90d9;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  transition: background 0.15s;
}

.ai-collapse-btn:hover {
  background: rgba(66, 153, 225, 0.1);
}

.ai-delete-btn {
  background: none;
  border: none;
  color: #cbd5e0;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.4rem;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}

.ai-delete-btn:hover {
  color: #e53e3e;
  background: #fff5f5;
}

.ai-analysis-body {
  overflow: hidden;
  transition: max-height 0.3s ease;
  max-height: 2000px;
}

.ai-analysis-body.collapsed {
  max-height: 0;
}

.taito-ai-summary h4 {
  color: #2b6cb0;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.taito-ai-summary .ai-badge {
  background: #667eea;
  color: #fff;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.taito-ai-summary .ai-summary-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #2d3748;
}

.taito-ai-summary .ai-summary-loading {
  text-align: center;
  padding: 1.5rem;
  color: #718096;
  font-size: 0.9rem;
}

.taito-ai-summary .ai-summary-loading .spinner {
  display: inline-block;
  margin-right: 0.5rem;
  border-color: rgba(113, 128, 150, 0.3);
  border-top-color: #718096;
}

.taito-ai-summary .ai-summary-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.taito-ai-summary .refresh-ai-btn {
  background: #667eea;
  color: #fff;
  padding: 0.3rem 0.7rem;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.taito-ai-summary .refresh-ai-btn:hover:not(:disabled) {
  background: #5a67d8;
}

/* Item-level checkbox tweaks */
.item-header-row .topic-checkbox {
  flex-shrink: 0;
}

.insight-item-header h4 .topic-checkbox {
  vertical-align: middle;
  margin-right: 0.3rem;
}

/* ============================================
   TIMEOUT PROVIDER ICON
   ============================================ */
.provider-icon.timeout {
  background: #ed8936;
}

.provider-icon.claude.timeout {
  background: #ed8936;
}

.provider-icon.codex.timeout {
  background: #ed8936;
}

/* ============================================
   AGENT RETRY BUTTON
   ============================================ */
.agent-retry-btn {
  background: #ed8936;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.5rem;
  transition: background 0.2s;
}

.agent-retry-btn:hover {
  background: #dd6b20;
}

/* ============================================
   FAILED INSIGHTS BANNER
   ============================================ */
.failed-insights-banner {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.failed-insights-banner .failed-message {
  color: #c53030;
  font-size: 0.85rem;
  font-weight: 500;
}

.failed-insights-banner .failed-tag {
  background: #fed7d7;
  color: #c53030;
  border: 1px solid #feb2b2;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.failed-insights-banner .failed-tag:hover {
  background: #feb2b2;
}

.failed-insights-banner .retry-all-btn {
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
  transition: background 0.2s;
}

.failed-insights-banner .retry-all-btn:hover {
  background: #c53030;
}

/* ============================================
   ANALYSIS CONTROLS (Short/Long toggle)
   ============================================ */
.analysis-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.analysis-type-toggle {
  display: flex;
  gap: 1rem;
}

.analysis-type-toggle .radio-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #4a5568;
  cursor: pointer;
}

.analysis-type-toggle input[type="radio"] {
  cursor: pointer;
}

.generate-analysis-btn {
  background: #667eea;
  color: #fff;
  padding: 0.4rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.generate-analysis-btn:hover:not(:disabled) {
  background: #5a67d8;
}

.generate-analysis-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.regenerate-btn {
  background: #ed8936;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.regenerate-btn:hover {
  background: #dd6b20;
}

.taito-rebuild-bar {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rebuild-analysis-btn {
  background: #667eea;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.rebuild-analysis-btn:hover:not(:disabled) {
  background: #5a67d8;
}

.rebuild-analysis-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.update-scores-btn {
  background: #48bb78;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  margin-left: 0.75rem;
  vertical-align: middle;
  transition: background 0.2s;
}

.update-scores-btn:hover:not(:disabled) {
  background: #38a169;
}

.update-scores-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.analysis-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #2d3748;
}

.analysis-content .analysis-loading {
  text-align: center;
  padding: 1.5rem;
  color: #718096;
}

.analysis-content .analysis-cached-info {
  font-size: 0.75rem;
  color: #718096;
  margin-bottom: 0.5rem;
  font-style: italic;
}

/* ============================================
   AUTH HINT
   ============================================ */
.auth-hint {
  display: block;
  font-size: 0.75rem;
  color: #718096;
  margin-top: 0.25rem;
  font-style: italic;
}

/* Filter fetched districts checkbox */
.filter-fetched-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #4a5568;
  cursor: pointer;
  margin-left: auto;
  white-space: nowrap;
}

.filter-fetched-label input[type="checkbox"] {
  cursor: pointer;
}

.fetched-badge {
  color: #38a169;
  font-size: 0.6rem;
  margin-right: 0.3rem;
  vertical-align: middle;
}

/* ============================================
   DISTRICT ACTIONS ROW
   ============================================ */
.district-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.queue-add-btn {
  background: #805ad5;
  color: #fff;
}

.queue-add-btn:hover:not(:disabled) {
  background: #6b46c1;
}

.queue-add-all-btn {
  background: #667eea;
  color: #fff;
}

.queue-add-all-btn:hover:not(:disabled) {
  background: #5a67d8;
}

/* ============================================
   SEARCH QUEUE PANEL
   ============================================ */
.queue-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.queue-start-btn {
  background: #48bb78;
  color: #fff;
}

.queue-start-btn:hover:not(:disabled) {
  background: #38a169;
}

.queue-stop-btn {
  background: #e53e3e;
  color: #fff;
}

.queue-stop-btn:hover:not(:disabled) {
  background: #c53030;
}

.queue-clear-btn {
  background: #a0aec0;
  color: #fff;
}

.queue-clear-btn:hover:not(:disabled) {
  background: #718096;
}

.queue-interval-control {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  font-size: 0.85rem;
  color: #4a5568;
}

.queue-interval-control input {
  width: 70px;
  padding: 0.3rem 0.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.queue-interval-control input:focus {
  outline: none;
  border-color: #4299e1;
}

.queue-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #ebf8ff;
  border: 1px solid #90cdf4;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: #2b6cb0;
}

#queue-countdown {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.queue-list {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.queue-empty {
  text-align: center;
  padding: 1.5rem;
  color: #a0aec0;
  font-size: 0.9rem;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

.queue-item:last-child {
  border-bottom: none;
}

.queue-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.queue-item-order {
  font-size: 0.8rem;
  color: #718096;
  min-width: 1.5em;
  flex-shrink: 0;
}

.queue-item-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.queue-item-name {
  font-weight: 500;
  color: #2d3748;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-state {
  font-size: 0.75rem;
  color: #718096;
  background: #edf2f7;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.queue-item-status {
  font-size: 0.75rem;
  font-weight: 500;
  flex-shrink: 0;
}

.queue-item-pending .queue-item-status { color: #718096; }
.queue-item-running .queue-item-status { color: #4299e1; }
.queue-item-completed .queue-item-status { color: #48bb78; }
.queue-item-failed .queue-item-status { color: #e53e3e; }

.queue-item-running {
  background: #ebf8ff;
}

.queue-item-completed {
  background: #f0fff4;
}

.queue-item-failed {
  background: #fff5f5;
}

.queue-item-error {
  font-size: 0.7rem;
  color: #c53030;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-remove-btn {
  background: #fed7d7;
  color: #c53030;
  border: none;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.queue-remove-btn:hover {
  background: #feb2b2;
}
