:root {
  --bg: #edf3fb;
  --bg-deep: #d9e7fa;
  --surface: #ffffff;
  --surface-soft: #f6faff;
  --text: #0f1f38;
  --muted: #4b5d7a;
  --brand: #0b5ed7;
  --brand-dark: #0847a6;
  --brand-soft: #dce9ff;
  --line: #d7e2f2;
  --danger-bg: #fff2f2;
  --danger-line: #f2c5c5;
  --danger-text: #9a1f1f;
  --success-bg: #eefaf3;
  --success-line: #bce7cb;
  --success-text: #17673b;
  --shadow-sm: 0 8px 24px rgba(16, 38, 72, 0.06);
  --shadow-md: 0 18px 44px rgba(16, 38, 72, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 9% 8%, #cfe2ff 0%, transparent 36%),
    radial-gradient(circle at 88% 14%, #bfd6ff 0%, transparent 32%),
    linear-gradient(180deg, var(--bg) 0%, #f7faff 100%);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(48px);
  z-index: -1;
  opacity: 0.5;
}

.orb-1 {
  width: 340px;
  height: 340px;
  background: #b8d2ff;
  top: -120px;
  right: -40px;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: #9fc2ff;
  bottom: -120px;
  left: -50px;
}

.topbar {
  max-width: 1280px;
  margin: 20px auto;
  padding: 14px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.topbar h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: #11284c;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 0.18s ease;
}

.topbar a:hover {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.welcome-user {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 8px 10px;
}

.logout-form {
  margin: 0;
}

.container {
  max-width: 1280px;
  margin: 0 auto 28px;
  padding: 0 12px;
}

.hero {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(160deg, #ffffff 0%, #f4f9ff 100%);
  box-shadow: var(--shadow-md);
}

.hero.compact {
  padding: 20px 24px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.72rem;
  color: var(--brand);
  font-weight: 800;
}

.hero h2 {
  margin: 8px 0 8px;
  font-size: 2rem;
  line-height: 1.15;
  color: #0f2445;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(170deg, #ffffff 0%, #f5faff 100%);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.5rem;
  color: #0b2d63;
}

.panel-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

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

.panel h3 {
  margin: 0 0 12px;
  font-size: 1.06rem;
  color: #15315c;
}

h4 {
  margin: 12px 0 8px;
  color: #1c3968;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e9f0fb;
  vertical-align: top;
}

th {
  color: #3d5577;
  font-weight: 800;
}

tbody tr:hover {
  background: #f7faff;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  padding: 10px 0;
  border-bottom: 1px solid #e9f0fb;
}

.list span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.83rem;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  background: #e5efff;
  color: #0a3e99;
  border: 1px solid #c7dbff;
  padding: 5px 10px;
  font-size: 0.76rem;
  font-weight: 800;
}

.inline-action {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

input,
select,
button,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #8bb4ff;
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.14);
}

button {
  border-color: var(--brand);
  background: linear-gradient(180deg, #1573ff 0%, #0b5ed7 100%);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
}

button:hover {
  filter: brightness(1.04);
}

button:active {
  transform: translateY(1px);
}

.ghost-btn {
  background: #eef4ff;
  border-color: #c5d8ff;
  color: #1d4fa7;
}

.auth-wrap {
  min-height: 72vh;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(160deg, #ffffff 0%, #f5f9ff 100%);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

.auth-card h2 {
  margin: 10px 0 8px;
}

.auth-card p {
  margin-top: 0;
  color: var(--muted);
}

.auth-form {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.alert-error,
.alert-success {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.alert-error {
  border: 1px solid var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.alert-success {
  border: 1px solid var(--success-line);
  background: var(--success-bg);
  color: var(--success-text);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  background: #ebf2ff;
  color: #1e4a94;
  border: 1px solid #c7dbff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.interest-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  color: var(--text);
}

.interest-select-large {
  min-height: 180px;
}

.interest-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.interest-update-form {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.interest-update-form .interest-select {
  min-width: 180px;
  max-width: 260px;
}

#wati-template-preview-select {
  min-width: 280px;
}

.wati-row-template-select {
  min-width: 180px;
}

.template-preview-box {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  white-space: pre-wrap;
  font-size: 0.88rem;
  color: #2f4668;
  min-height: 94px;
}

@media (max-width: 1080px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .hero h2 {
    font-size: 1.6rem;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar nav {
    width: 100%;
  }

  .topbar a {
    font-size: 0.85rem;
    padding: 7px 10px;
  }

  .container {
    padding: 0 10px;
  }

  .hero,
  .panel {
    padding: 14px;
  }

  table {
    font-size: 0.84rem;
  }
}

.help-inline {
  font-size: .85rem;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 28, 58, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 18px;
}

.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 16px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-head h3 {
  margin: 0;
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-leads-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.bulk-lead-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 8px;
}

.bulk-lead-item:hover {
  background: var(--surface-soft);
}
