:root {
  --bg: #09111f;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #fffdf8;
  --surface-dark: #132239;
  --border: rgba(19, 34, 57, 0.1);
  --text: #172338;
  --muted: #617084;
  --white: #f8fbff;
  --brand: #2c82e8;
  --brand-dark: #15579d;
  --success: #3f8122;
  --success-bg: #e7f1dc;
  --amber: #91570c;
  --amber-bg: #f8ead5;
  --gray: #5d5f63;
  --gray-bg: #ebe6db;
  --danger: #ae4644;
  --danger-bg: #f8dddd;
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 14px 36px rgba(15, 26, 43, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: "Manrope", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(69, 143, 229, 0.26), transparent 30%),
    radial-gradient(circle at bottom right, rgba(229, 169, 88, 0.2), transparent 28%),
    linear-gradient(135deg, #0a1221 0%, #122544 50%, #07101f 100%);
}

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

button {
  border: 0;
}

.page-shell {
  width: min(1320px, calc(100% - 28px));
  margin: 14px auto;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - 28px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 32px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.44)),
    linear-gradient(180deg, #f8f7f2, #f0ecdf);
  box-shadow: var(--shadow-lg);
}

.sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(10, 18, 32, 0.98), rgba(20, 38, 65, 0.96)),
    var(--surface-dark);
  color: var(--white);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #61abff, #16589e);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(38, 117, 213, 0.28);
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
}

.brand-copy {
  margin-top: 2px;
  color: rgba(248, 251, 255, 0.64);
  font-size: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  background: transparent;
  color: rgba(248, 251, 255, 0.74);
  text-align: left;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(81, 157, 245, 0.34), rgba(21, 87, 157, 0.52));
  color: #fff;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-note strong {
  display: block;
  margin-bottom: 8px;
}

.sidebar-note p {
  margin: 0;
  color: rgba(248, 251, 255, 0.68);
  line-height: 1.7;
  font-size: 13px;
}

.main-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.page.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-head h1,
.section-head h2,
.hero-card h2,
.empty-state h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.page-head h1 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.eyebrow-dark {
  color: var(--muted);
}

.eyebrow-light {
  color: rgba(248, 251, 255, 0.62);
}

.page-copy,
.section-copy,
.hero-copy,
.metric-copy,
.empty-state p,
.lead-sub,
.activity-copy,
.status-copy {
  color: var(--muted);
  line-height: 1.7;
}

.head-actions,
.list-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(17, 46, 89, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}

.btn-secondary,
.btn-ghost,
.btn-danger {
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  border: 1px solid rgba(19, 34, 57, 0.1);
}

.btn-danger {
  color: var(--danger);
  background: rgba(248, 221, 221, 0.86);
  border-color: rgba(174, 70, 68, 0.18);
}

.import-btn {
  margin-top: 12px;
}

.hero-card,
.card,
.metric-card,
.empty-state {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.hero-card {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 18px;
  padding: 24px;
  margin-bottom: 20px;
  background:
    radial-gradient(circle at top right, rgba(101, 173, 255, 0.18), transparent 28%),
    linear-gradient(135deg, rgba(18, 33, 57, 0.98), rgba(27, 55, 92, 0.94));
  color: var(--white);
}

.hero-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

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

.metric-card,
.card {
  padding: 20px;
}

.metric-label {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 800;
}

.metric-value {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 800;
}

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

.align-start {
  align-items: start;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

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

.field-span-2 {
  grid-column: span 2;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(19, 34, 57, 0.12);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(44, 130, 232, 0.52);
  box-shadow: 0 0 0 4px rgba(44, 130, 232, 0.1);
}

textarea {
  resize: vertical;
}

.lead-row,
.pipeline-row,
.activity-row,
.status-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid rgba(19, 34, 57, 0.08);
}

.lead-row:last-child,
.pipeline-row:last-child,
.activity-row:last-child,
.status-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dcecff;
  color: var(--brand-dark);
  font-weight: 800;
  flex-shrink: 0;
}

.lead-main,
.activity-main,
.pipeline-main {
  flex: 1;
  min-width: 0;
}

.lead-title,
.activity-title,
.pipeline-title {
  margin: 0;
  font-weight: 800;
}

.lead-sub,
.activity-copy,
.status-copy {
  margin: 4px 0 0;
  font-size: 13px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(19, 34, 57, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.new,
.badge.ready {
  background: #dcecff;
  color: var(--brand-dark);
}

.badge.researching,
.badge.follow-up {
  background: var(--amber-bg);
  color: var(--amber);
}

.badge.contacted,
.badge.closed {
  background: var(--gray-bg);
  color: var(--gray);
}

.badge.interested {
  background: var(--success-bg);
  color: var(--success);
}

.badge.not-interested {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.low {
  background: var(--gray-bg);
  color: var(--gray);
}

.badge.medium {
  background: #dcecff;
  color: var(--brand-dark);
}

.badge.high {
  background: var(--danger-bg);
  color: var(--danger);
}

.lead-actions,
.pipeline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(19, 34, 57, 0.1);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.mini-btn.danger {
  color: var(--danger);
  background: rgba(248, 221, 221, 0.88);
  border-color: rgba(174, 70, 68, 0.18);
}

.pipeline-grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(120px, 0.4fr));
  gap: 10px;
  align-items: start;
}

.empty-state {
  padding: 26px;
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 16px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(10, 18, 32, 0.94);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1120px) {
  .metric-grid,
  .grid-two {
    grid-template-columns: 1fr 1fr;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

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

@media (max-width: 680px) {
  .page {
    padding: 18px;
  }

  .metric-grid,
  .grid-two,
  .field-grid,
  .pipeline-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  .page-head,
  .section-head {
    flex-direction: column;
  }

  .head-actions,
  .list-controls,
  .lead-actions,
  .pipeline-actions {
    width: 100%;
  }

  .btn,
  .mini-btn {
    width: 100%;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }
}
