:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #65708a;
  --line: #dbe2ef;
  --primary: #1f6feb;
  --primary-dark: #174ea6;
  --danger: #c2410c;
  --shadow: 0 20px 45px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #e8f1ff 0, transparent 34rem), var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 0.75rem;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.8rem 1rem;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

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

button.secondary {
  background: #eef4ff;
  color: var(--primary-dark);
}

button.secondary:hover:not(:disabled) {
  background: #dceaff;
}

button.compact {
  border-radius: 0.6rem;
  padding: 0.45rem 0.7rem;
}

.app-shell {
  margin: 0 auto;
  max-width: 1400px;
  padding: 2rem;
}

.hero {
  align-items: stretch;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr minmax(220px, 320px);
  margin-bottom: 1.5rem;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin: 0 0 0.65rem;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.25rem);
  letter-spacing: -0.06em;
  line-height: 0.95;
  margin: 0;
}

.hero-copy {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 1rem 0 0;
  max-width: 760px;
}

.hero-card,
.panel,
.toolbar,
.table-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(219, 226, 239, 0.9);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem;
}

.hero-card strong {
  font-size: 3rem;
  line-height: 1;
}

.hero-card span {
  color: var(--muted);
  margin-top: 0.5rem;
}

.panel {
  padding: 1.25rem;
}

.search-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(160px, 0.8fr) repeat(3, minmax(180px, 1fr)) auto;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.86rem;
  font-weight: 700;
  gap: 0.45rem;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: var(--text);
  padding: 0.78rem 0.9rem;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(31, 111, 235, 0.12);
}

.form-actions {
  align-items: end;
  display: flex;
  gap: 0.65rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 1rem 0 0;
}

.toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 1rem 0;
  padding: 1rem 1.25rem;
}

.status,
.error {
  margin: 0;
}

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

.error {
  color: var(--danger);
  font-weight: 700;
  margin-top: 0.35rem;
}

.toolbar-actions {
  display: flex;
  gap: 0.75rem;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 0.9rem;
  justify-content: flex-end;
  margin: 0 0 1rem;
}

.pagination span {
  color: var(--muted);
  font-weight: 800;
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 940px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.9rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

tbody tr:hover {
  background: #fbfdff;
}

a {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.empty-state {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.category-list {
  color: var(--muted);
  max-width: 220px;
}

.name-cell {
  font-weight: 800;
  min-width: 210px;
}

.address-cell {
  min-width: 260px;
}

.social-links {
  min-width: 150px;
}

.social-links a {
  display: inline-block;
  margin: 0 0.5rem 0.3rem 0;
}

.nowrap {
  white-space: nowrap;
}

.status-badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
}

.status-badge.profiled {
  background: #dcfce7;
  color: #166534;
}

.status-badge.not-profiled {
  background: #f1f5f9;
  color: #475569;
}

.ticket-link {
  white-space: nowrap;
}

.lead-dialog {
  background: transparent;
  border: 0;
  max-width: min(900px, calc(100vw - 2rem));
  padding: 0;
  width: 100%;
}

.lead-dialog::backdrop {
  background: rgba(23, 32, 51, 0.55);
}

.dialog-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 3rem);
  overflow: auto;
  padding: 1.25rem;
}

.dialog-header {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding-bottom: 1rem;
}

.dialog-actions {
  display: flex;
  gap: 0.6rem;
}

.dialog-header h2 {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  margin: 0;
}

.dialog-body {
  padding-top: 1rem;
}

.profile-status {
  color: var(--muted);
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-weight: 700;
  min-height: 1.5rem;
  padding-top: 1rem;
}

.loader {
  animation: spin 0.8s linear infinite;
  border: 3px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 999px;
  display: inline-block;
  height: 1.15rem;
  width: 1.15rem;
}

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

.profile-card {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  margin-top: 1rem;
  padding: 1rem;
}

.profile-card h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.lead-details {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(150px, 220px) 1fr;
  margin: 0;
}

.lead-details dt,
.lead-details dd {
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 0.8rem 0;
}

.lead-details dt {
  color: var(--muted);
  font-weight: 800;
  padding-right: 1rem;
}

.lead-details dd {
  overflow-wrap: anywhere;
}

.detail-list {
  display: grid;
  gap: 0.35rem;
}

.compact-details dt,
.compact-details dd {
  padding: 0.55rem 0;
}

@media (max-width: 1000px) {
  .hero,
  .search-form {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .toolbar-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .lead-details {
    grid-template-columns: 1fr;
  }

  .lead-details dt {
    border-bottom: 0;
    padding-bottom: 0.2rem;
  }

  .lead-details dd {
    padding-top: 0;
  }
}
