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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
}

header {
  background: #1a1a2e;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { font-size: 1.25rem; }
#user-info { display: flex; align-items: center; gap: 1rem; }
#user-info button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
}

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

/* Login */
#login-section { text-align: center; margin-top: 4rem; }
#login-btn {
  background: #1877f2;
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 1rem;
}
#login-btn:hover { background: #166fe5; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #ddd;
  margin-bottom: 1.5rem;
}
.tab {
  background: none;
  border: none;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab.active { color: #1877f2; border-bottom-color: #1877f2; font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Cards */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.card .meta { font-size: 0.8rem; color: #888; margin-bottom: 0.5rem; }
.card .message { margin: 0.5rem 0; }

/* Comments */
.comment {
  padding: 0.75rem;
  border-left: 3px solid #e0e0e0;
  margin: 0.5rem 0 0.5rem 1rem;
  background: #fafafa;
  border-radius: 0 4px 4px 0;
}
.comment .author { font-weight: 600; font-size: 0.9rem; }
.comment .text { font-size: 0.9rem; margin: 0.25rem 0; }

/* Buttons */
.actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn:hover { background: #f0f0f0; }
.btn.danger { color: #e74c3c; border-color: #e74c3c; }
.btn.danger:hover { background: #fdf0ef; }
.btn.primary, button.primary {
  background: #1877f2;
  color: #fff;
  border-color: #1877f2;
}
.btn.primary:hover, button.primary:hover { background: #166fe5; }

/* Page selector */
.page-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}
.page-card img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
.page-card:hover { background: #f0f7ff; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-content {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  width: 90%;
  max-width: 500px;
}
.modal-content h3 { margin-bottom: 1rem; }
.modal-content textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.modal-actions button {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  background: #fff;
}

/* Conversations */
.conversation {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
}
.conversation:hover { background: #f0f7ff; }
.conversation .preview { color: #666; font-size: 0.9rem; }

.message-thread { margin-top: 1rem; }
.msg {
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0;
  border-radius: 8px;
  max-width: 80%;
  font-size: 0.9rem;
}
.msg.from-page { background: #1877f2; color: #fff; margin-left: auto; }
.msg.from-user { background: #e4e6eb; }

/* Utility */
.hidden { display: none !important; }
.prose { max-width: 640px; }
.prose h2 { margin: 1.5rem 0 0.5rem; }
.prose p, .prose ul { margin-bottom: 0.75rem; }
.prose ul { padding-left: 1.5rem; }
.loading { text-align: center; padding: 2rem; color: #888; }
.error { color: #e74c3c; padding: 0.5rem; }
