:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e0e2e7;
  --text: #1c1e21;
  --muted: #6b7280;
  --accent: #2563eb;
  --danger: #dc2626;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.my-leads-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.current-user {
  font-size: 13px;
  color: var(--muted);
}

.logout-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary:hover { opacity: 0.9; }

.btn-danger {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
}

.table-wrap {
  padding: 20px 24px;
  overflow-x: auto;
}

#leads-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}

#leads-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

#leads-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

#leads-table tbody tr {
  cursor: pointer;
}

#leads-table tbody tr:hover {
  background: #f9fafb;
}

#leads-table tbody tr:last-child td {
  border-bottom: none;
}

.lead-info-cell {
  color: var(--muted);
  max-width: 480px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted {
  color: var(--muted);
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: capitalize;
  background: #eef1f5;
  color: var(--text);
}

.status-new { background: #e0edff; color: #1d4ed8; }
.status-attempted { background: #fef3c7; color: #92400e; }
.status-qualified { background: #ede9fe; color: #6d28d9; }
.status-sent { background: #dbeafe; color: #1e40af; }
.status-sold { background: #d1fae5; color: #047857; }
.status-lost { background: #fee2e2; color: #b91c1c; }

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  width: 420px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

#lead-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#lead-form h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

#lead-form label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  gap: 4px;
}

#lead-form input,
#lead-form select,
#lead-form textarea {
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
}

#lead-form textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  resize: vertical;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.dialog-actions .spacer { flex: 1; }

.dialog-actions button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
}
