:root {
  --bg: #f6f7fb;
  --bg-soft: #fbfcff;
  --panel: #ffffff;
  --text: #111827;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e6eaf0;
  --line-strong: #d7deea;
  --brand: #0b0f19;
  --accent: #315cff;
  --accent-soft: #edf2ff;
  --success: #16a36a;
  --warning: #d89116;
  --danger: #dc3e42;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 14px 34px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, .12);
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at 85% -10%, rgba(49, 92, 255, .1), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(18px);
  border-right: 1px solid rgba(230, 234, 240, .86);
  bottom: 0;
  display: flex;
  flex-direction: column;
  left: 0;
  padding: 22px 16px;
  position: fixed;
  top: 0;
  width: 278px;
  z-index: 1040;
}

.brand {
  margin-bottom: 28px;
}

.brand-lockup {
  align-items: center;
  border-radius: 16px;
  display: flex;
  gap: 12px;
  padding: 8px;
}

.brand-lockup:hover {
  background: var(--bg-soft);
}

.brand-mark {
  align-items: center;
  background: var(--brand);
  border-radius: 12px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 38px;
  font-weight: 820;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 15px;
}

.brand-lockup small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin-top: 2px;
}

.app-nav {
  gap: 5px;
}

.nav-link {
  align-items: center;
  border-radius: 14px;
  color: var(--muted);
  display: flex;
  font-size: 14px;
  font-weight: 720;
  gap: 11px;
  padding: 11px 12px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-link:hover,
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-link.active {
  box-shadow: inset 0 0 0 1px rgba(49, 92, 255, .08);
}

.nav-icon {
  border: 1px solid currentColor;
  border-radius: 9px;
  flex: 0 0 18px;
  height: 18px;
  opacity: .82;
  position: relative;
  width: 18px;
}

.nav-icon-grid::before,
.nav-icon-grid::after,
.nav-icon-leads::before,
.nav-icon-sync::before,
.nav-icon-settings::before {
  background: currentColor;
  border-radius: 99px;
  content: "";
  position: absolute;
}

.nav-icon-grid::before {
  height: 4px;
  left: 4px;
  top: 4px;
  width: 4px;
  box-shadow: 6px 0 0 currentColor, 0 6px 0 currentColor, 6px 6px 0 currentColor;
}

.nav-icon-leads::before {
  height: 2px;
  left: 4px;
  top: 5px;
  width: 9px;
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}

.nav-icon-sync::before {
  border: 2px solid currentColor;
  background: transparent;
  border-left-color: transparent;
  border-radius: 999px;
  height: 9px;
  left: 3px;
  top: 3px;
  width: 9px;
}

.nav-icon-settings::before {
  height: 8px;
  left: 4px;
  top: 4px;
  width: 8px;
}

.sidebar-card {
  align-items: flex-start;
  background: linear-gradient(180deg, #fff, #f8faff);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 11px;
  margin-top: auto;
  padding: 16px;
}

.sync-dot {
  background: var(--faint);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(152, 162, 179, .14);
  flex: 0 0 9px;
  height: 9px;
  margin-top: 5px;
  width: 9px;
}

.sync-dot.is-live {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(22, 163, 106, .14);
}

.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.sidebar-card strong {
  font-size: 13px;
}

.sidebar-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}

.sidebar-backdrop {
  display: none;
}

.main {
  margin-left: 278px;
  min-width: 0;
  width: calc(100% - 278px);
}

.topbar {
  align-items: center;
  background: rgba(246, 247, 251, .78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(230, 234, 240, .86);
  display: flex;
  gap: 16px;
  min-height: 82px;
  padding: 18px 32px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.menu-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  padding: 0;
  position: relative;
  width: 42px;
}

.menu-button span {
  background: var(--text);
  border-radius: 99px;
  height: 2px;
  position: absolute;
  width: 17px;
}

.menu-button span:first-child {
  transform: translateY(-4px);
}

.menu-button span:last-child {
  transform: translateY(4px);
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.page-title {
  color: var(--brand);
  font-size: 24px;
  font-weight: 780;
  letter-spacing: 0;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.quick-action,
.btn-app {
  align-items: center;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  font-size: 14px;
  font-weight: 760;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
  white-space: nowrap;
}

.quick-action,
.btn-app-light {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
}

.quick-action:hover,
.btn-app-light:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-app-dark {
  background: var(--brand);
  color: #fff;
}

.btn-app-dark:hover {
  background: var(--accent);
  box-shadow: 0 16px 34px rgba(49, 92, 255, .22);
  color: #fff;
  transform: translateY(-1px);
}

.btn-app:disabled,
.btn-app.disabled,
a.disabled {
  opacity: .48;
  pointer-events: none;
}

.btn-app-sm {
  font-size: 13px;
  min-height: 34px;
  padding: 0 14px;
}

.user-menu {
  align-items: center;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  gap: 10px;
  padding: 6px 12px 6px 6px;
}

.user-menu > span,
.lead-cell > span {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  flex: 0 0 34px;
  font-size: 13px;
  font-weight: 820;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.user-menu strong,
.user-menu a {
  display: block;
  line-height: 1.2;
}

.user-menu strong {
  font-size: 13px;
}

.user-menu a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.content {
  padding: 30px 32px 42px;
}

.app-alert {
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.page-hero {
  align-items: flex-end;
  background:
    radial-gradient(circle at 90% 0, rgba(49, 92, 255, .12), transparent 30%),
    #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 28px;
}

.page-hero h2 {
  color: var(--brand);
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0;
  max-width: 760px;
}

.hero-actions,
.button-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions form,
.button-row form {
  margin: 0;
}

.hero-mini-stats {
  display: flex;
  gap: 10px;
}

.hero-mini-stats div {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-width: 92px;
  padding: 12px 14px;
}

.hero-mini-stats strong,
.hero-mini-stats span {
  display: block;
}

.hero-mini-stats strong {
  font-size: 22px;
}

.hero-mini-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}

.metric-card,
.panel {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}

.metric-card {
  padding: 22px;
}

.metric-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.metric-top span,
.metric-top em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 780;
}

.metric-top em {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
}

.metric-card strong {
  color: var(--brand);
  display: block;
  font-size: 36px;
  line-height: 1;
  margin-top: 18px;
}

.metric-card small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-top: 10px;
}

.dashboard-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .8fr);
}

.side-stack {
  display: grid;
  gap: 22px;
}

.panel {
  padding: 22px;
}

.panel-large {
  min-width: 0;
}

.panel-header {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-header.compact {
  margin-bottom: 14px;
}

.panel-header h3 {
  font-size: 19px;
  font-weight: 780;
  letter-spacing: 0;
  margin: 0;
}

.text-link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 780;
}

.app-table {
  border-color: var(--line);
  color: var(--text);
}

.app-table thead th {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  padding: 13px 14px;
}

.app-table tbody td {
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  padding: 15px 14px;
  vertical-align: middle;
}

.app-table tbody tr {
  transition: background .16s ease;
}

.app-table tbody tr:hover {
  background: #fbfcff;
}

.lead-cell {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 220px;
}

.lead-cell strong,
.lead-cell small {
  display: block;
}

.lead-cell strong {
  font-size: 14px;
}

.lead-cell small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.status-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  padding: 7px 10px;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-new { background: #eaf0ff; color: #2347d8; }
.status-contacted { background: #fff5dc; color: #9a640c; }
.status-qualified { background: #e8f8f0; color: #0f7d4d; }
.status-converted { background: #def7ec; color: #067647; }
.status-lost { background: #ffe7e8; color: #ba1a28; }

.status-list,
.campaign-list,
.activity-timeline,
.info-list {
  display: grid;
  gap: 14px;
}

.status-row > div,
.campaign-row > div,
.info-list div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.status-row strong,
.campaign-row strong,
.info-list strong {
  font-size: 14px;
}

.campaign-row span,
.info-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-track {
  background: #edf1f7;
  border-radius: 999px;
  display: block;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  width: 100%;
}

.progress-track i {
  background: linear-gradient(90deg, var(--accent), #19b6d2);
  border-radius: inherit;
  display: block;
  height: 100%;
}

.timeline-item {
  display: grid;
  gap: 11px;
  grid-template-columns: 10px 1fr;
}

.timeline-item > span {
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(49, 92, 255, .12);
  height: 8px;
  margin-top: 7px;
  width: 8px;
}

.timeline-item strong,
.timeline-item small {
  display: block;
}

.timeline-item strong {
  font-size: 14px;
}

.timeline-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}

.empty-state {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 160px;
  padding: 24px;
  text-align: center;
}

.empty-state.slim {
  align-items: flex-start;
  min-height: auto;
  padding: 8px 0;
  text-align: left;
}

.empty-state strong {
  color: var(--brand);
  display: block;
  font-size: 15px;
}

.empty-state span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.5;
  margin-top: 5px;
}

.filter-panel {
  padding: 16px;
}

.filter-bar {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 240px) auto;
}

.filter-control,
.form-field {
  display: grid;
  gap: 7px;
}

.filter-control label,
.form-field label,
.form-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 0;
}

.filter-control input,
.filter-control select,
.form-field input,
.form-field select,
.form-control,
.form-select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: none;
  color: var(--text);
  min-height: 44px;
  padding: 10px 13px;
}

.form-control:focus,
.form-select:focus,
.filter-control input:focus,
.filter-control select:focus,
.form-field input:focus {
  border-color: rgba(49, 92, 255, .55);
  box-shadow: 0 0 0 4px rgba(49, 92, 255, .1);
  outline: 0;
}

textarea.form-control {
  border-radius: 16px;
}

.status-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-chip {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  padding: 6px 10px 6px 6px;
}

.status-chip strong {
  font-size: 13px;
}

.app-modal .modal-content {
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.app-modal .modal-header,
.app-modal .modal-footer {
  background: var(--bg-soft);
  border-color: var(--line);
  padding: 20px 22px;
}

.app-modal .modal-title {
  font-size: 22px;
  margin: 0;
}

.app-modal .modal-body {
  padding: 22px;
}

.lead-detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.detail-card span,
.detail-card strong {
  display: block;
}

.detail-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-transform: capitalize;
}

.detail-card strong {
  font-size: 14px;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.settings-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr);
}

.connection-pill {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: 8px;
  padding: 9px 13px;
}

.connection-pill span {
  background: var(--faint);
  border-radius: 999px;
  height: 8px;
  width: 8px;
}

.connection-pill.is-live {
  color: var(--success);
}

.connection-pill.is-live span {
  background: var(--success);
}

.notice-card {
  border-radius: 16px;
  display: grid;
  gap: 5px;
  padding: 15px;
}

.notice-card.warning {
  background: #fff8e8;
  color: #7a4b04;
}

.notice-card strong,
.notice-card span {
  display: block;
}

.notice-card span {
  font-size: 13px;
  line-height: 1.5;
}

.stack-form,
.settings-form {
  display: grid;
  gap: 16px;
}

.settings-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-form .form-actions,
.toggle-card {
  grid-column: 1 / -1;
}

.toggle-card {
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  gap: 14px;
  padding: 16px;
}

.toggle-card input {
  position: absolute;
  opacity: 0;
}

.toggle-card > span {
  background: #d8dfeb;
  border-radius: 999px;
  flex: 0 0 44px;
  height: 26px;
  position: relative;
  transition: background .18s ease;
  width: 44px;
}

.toggle-card > span::after {
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  content: "";
  height: 20px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform .18s ease;
  width: 20px;
}

.toggle-card input:checked + span {
  background: var(--accent);
}

.toggle-card input:checked + span::after {
  transform: translateX(18px);
}

.toggle-card strong,
.toggle-card small {
  display: block;
}

.toggle-card small {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.auth-page {
  align-items: center;
  background:
    radial-gradient(circle at 80% 5%, rgba(49, 92, 255, .12), transparent 34%),
    var(--bg);
  display: flex;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  margin: auto;
  max-width: 450px;
  padding: 30px;
  width: 100%;
}

.auth-card .brand {
  align-items: center;
  display: flex;
  font-weight: 780;
  gap: 10px;
  margin-bottom: 24px;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .sidebar {
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.is-open {
    background: rgba(15, 23, 42, .28);
    bottom: 0;
    display: block;
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1030;
  }

  .main {
    margin-left: 0;
    width: 100%;
  }

  .topbar,
  .content {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 74px;
  }

  .topbar-actions .quick-action {
    display: none;
  }

  .user-menu {
    padding-right: 6px;
  }

  .user-menu div {
    display: none;
  }

  .page-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px;
  }

  .hero-actions,
  .hero-actions .btn-app,
  .hero-actions form,
  .hero-actions button {
    width: 100%;
  }

  .metric-grid,
  .filter-bar,
  .settings-form,
  .lead-detail-grid {
    grid-template-columns: 1fr;
  }

  .hero-mini-stats {
    width: 100%;
  }

  .hero-mini-stats div {
    flex: 1;
  }

  .panel {
    padding: 18px;
  }
}

@media (max-width: 520px) {
  .content {
    padding-top: 20px;
  }

  .page-title {
    font-size: 20px;
  }

  .page-hero h2 {
    font-size: 28px;
  }

  .metric-card strong {
    font-size: 31px;
  }

  .app-table thead {
    display: none;
  }

  .app-table tbody tr {
    display: block;
    padding: 10px 0;
  }

  .app-table tbody td {
    border-bottom: 0;
    display: block;
    padding: 9px 4px;
  }

  .app-table tbody td.text-end {
    text-align: left !important;
  }
}

