:root {
  --plum: #5E2A8A;
  --plum-deep: #3F1B5E;
  --plum-soft: #F3EBFA;
  --gold: #E5B84B;
  --ink: #1A1A1A;
  --ink-soft: #4A4A4A;
  --bg: #FFFFFF;
  --cream: #FAF7F2;
  --line: #E6E0EE;
  --ok: #2E7D5B;
  --err: #B23A48;
  --shadow: 0 8px 24px rgba(63, 27, 94, .10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }

a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Top bar */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--plum);
  letter-spacing: .02em;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  display: inline-block;
}

/* Forms / inputs */
input, button {
  font: inherit;
  color: inherit;
}
input[type="email"],
input[type="search"],
input[type="text"] {
  background: #FBFAFD;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  width: 100%;
  transition: border-color .15s, background .15s;
}
input:focus {
  outline: none;
  border-color: var(--plum);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(94, 42, 138, .10);
}

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--plum);
  color: #fff;
  transition: background .15s, transform .15s;
}
.btn:hover { background: var(--plum-deep); transform: translateY(-1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-outline {
  background: transparent;
  color: var(--plum);
  border-color: var(--plum);
}
.btn-outline:hover { background: var(--plum); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: .78rem; }

/* Login card */
.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 36px;
  max-width: 420px;
  width: 100%;
  border-top: 5px solid var(--plum);
}
.card h1 { margin-bottom: .25em; }
.card p.lede {
  color: var(--ink-soft);
  margin: 0 0 20px;
  font-size: .94rem;
}
.field-row { margin-bottom: 16px; }
label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: .02em;
}

/* Banners */
.banner {
  display: none;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 14px 0 0;
  font-size: .9rem;
  border: 1.5px solid transparent;
}
.banner.show { display: block; }
.banner-ok {
  background: #E8F5EE;
  color: #1F5A40;
  border-color: var(--ok);
}
.banner-err {
  background: #FDECEE;
  color: #6B1B25;
  border-color: var(--err);
}

/* Leads page */
.page-wrap {
  padding: 24px 0 64px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0 16px;
}
.toolbar .search {
  flex: 1 1 280px;
  max-width: 420px;
}
.toolbar .search label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 6px;
}
.toolbar .actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lead-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.lead-table th,
.lead-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.lead-table th {
  background: var(--plum-soft);
  font-weight: 700;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--plum-deep);
}
.lead-table tbody tr {
  cursor: pointer;
  transition: background .12s;
}
.lead-table tbody tr:hover { background: #FBFAFD; }
.lead-table tbody tr:last-child td { border-bottom: none; }

.badge-stage {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--line);
  color: var(--ink-soft);
}
.badge-stage.committed,
.badge-stage.active { background: #E8F5EE; color: var(--ok); }
.badge-stage.failed { background: #FDECEE; color: var(--err); }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-soft);
}

.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  font-size: .88rem;
  color: var(--ink-soft);
}
.pager .pager-buttons { display: flex; gap: 8px; }

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 15, 42, .55);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.show {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  padding: 28px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: .92rem;
}
.modal dt {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.modal dd { margin: 0; word-break: break-word; }
.modal .close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--ink-soft);
  padding: 4px 8px;
  border-radius: 6px;
}
.modal .close:hover { background: var(--cream); }

.muted { color: var(--ink-soft); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
