:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #0f172a;
  background-color: #f4f6fb;
  line-height: 1.4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

header {
  background: #0f172a;
  color: #fff;
  padding: 2rem 1rem;
}

header .subtitle {
  margin: 0.5rem 0 0;
  color: rgba(255, 255, 255, 0.8);
}

.container {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 0 1rem;
}

main.container {
  padding: 2rem 1rem 4rem;
}

.card {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-subtitle {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
}

.inline-filters {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.inline-filters label {
  font-size: 0.85rem;
  color: #475569;
}

h1,
h2,
h3 {
  margin: 0 0 0.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.form-grid h3 {
  grid-column: 1 / -1;
  margin: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border-radius: 0.5rem;
  border: 1px solid #cbd5f5;
  padding: 0.55rem 0.75rem;
  background: #fff;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

.form-grid textarea {
  min-height: 120px;
}

.full-width {
  grid-column: 1 / -1;
}

.button-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.25rem;
  background: #2563eb;
  color: white;
  cursor: pointer;
  transition: background 0.2s ease;
}

button.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

button:hover {
  background: #1d4ed8;
}

button.secondary:hover {
  background: #cbd5f5;
}

.table-wrapper {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

th {
  text-align: left;
  font-weight: 600;
  color: #475569;
}

.leads-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.leads-table tbody tr.selected {
  background: #dbeafe;
}

.table-meta {
  margin: 0.25rem 0 1rem;
  color: #64748b;
  font-size: 0.9rem;
}

.muted {
  text-align: center;
  color: #94a3b8;
}

.token-display {
  margin-top: 1rem;
}

.session-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 0;
}

.session-meta dt {
  font-weight: 600;
  color: #475569;
}

.session-meta dd {
  margin: 0.25rem 0 0;
}

#alerts {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  display: none;
}

#alerts[data-type] {
  display: block;
}

#alerts[data-type='success'] {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #9ae6b4;
}

#alerts[data-type='error'] {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

#alerts[data-type='info'] {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
