/* Admin Dashboard Styles — matches Kiflow theme */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 48px 64px;
}
.admin-header h1 {
  font-size: 2rem;
  margin-bottom: 4px;
}
.admin-subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  text-align: center;
}
.stat-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--fg);
}
.stat-label-s {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* Tabs */
.tab-row {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.2s;
}
.tab-btn:hover { color: var(--fg); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content h2 { font-size: 1.3rem; margin-bottom: 20px; }

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:hover { background: var(--accent-bg); }
.data-table .clickable { cursor: pointer; }
.truncate { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block;
  background: var(--bg-alt);
  color: var(--fg);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
}
.badge-new { background: #e8f5e9; color: #2e7d32; }
.badge-nurtured { background: #e3f2fd; color: #1565c0; }
.badge-contacted { background: #fdf3e7; color: #e07a15; }

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary {
  background: var(--bg-alt);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}
.btn-danger-sm {
  background: none;
  border: 1px solid #e57373;
  color: #e57373;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}
.btn-danger-sm:hover { background: #ffebee; }

/* Forms */
.add-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.form-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}
.form-input:focus { border-color: var(--accent); }
.form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-family: 'DM Sans', sans-serif;
  resize: vertical;
  outline: none;
  margin-bottom: 12px;
}
.form-textarea:focus { border-color: var(--accent); }
.form-actions { display: flex; gap: 8px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--fg-muted);
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.empty-state a { color: var(--accent); }

/* Setup cards */
.setup-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}
.setup-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.setup-card p { color: var(--fg-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 12px; }
.code-block {
  background: var(--fg);
  color: #e0e0e0;
  padding: 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  overflow-x: auto;
  line-height: 1.5;
}

/* Message detail */
.message-detail {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}
.message-detail h3 { font-size: 1.05rem; margin-bottom: 16px; }
.msg-list { display: flex; flex-direction: column; gap: 8px; }
.msg-bubble {
  padding: 8px 14px;
  border-radius: 12px;
  max-width: 80%;
  font-size: 0.88rem;
  line-height: 1.5;
}
.msg-user {
  background: var(--accent-bg);
  align-self: flex-end;
}
.msg-assistant {
  background: var(--bg-alt);
  align-self: flex-start;
}
.msg-role {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 2px;
}

@media (max-width: 900px) {
  .admin-container { padding: 24px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .tab-row { overflow-x: auto; }
  .form-row { flex-direction: column; }
  .form-row .form-input { width: 100% !important; }
}
