:root {
  --bg: #eef4fb;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --text: #172033;
  --muted: #6a7387;
  --line: rgba(23, 32, 51, 0.08);
  --primary: #0e7490;
  --primary-deep: #0f3c66;
  --primary-soft: #d7f1f8;
  --success-bg: rgba(220, 252, 231, 0.9);
  --success-text: #166534;
  --error-bg: rgba(254, 226, 226, 0.92);
  --error-text: #b91c1c;
  --shadow: 0 24px 60px rgba(15, 60, 102, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(14, 116, 144, 0.2), transparent 28%),
    radial-gradient(circle at right center, rgba(255, 159, 67, 0.15), transparent 24%),
    linear-gradient(180deg, #f9fbff 0%, #edf3fb 100%);
}

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

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

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(15, 60, 102, 0.08);
}

.auth-shell,
.page-shell {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  gap: 24px;
}

.auth-shell {
  grid-template-columns: 1.15fr minmax(320px, 460px);
  align-items: stretch;
}

.page-shell {
  grid-template-columns: minmax(280px, 320px) 1fr;
}

.auth-hero,
.auth-card,
.sidebar,
.panel,
.hero,
.metric-card,
.flash-message {
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-hero,
.auth-card,
.sidebar,
.panel,
.hero {
  padding: 28px;
}

.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(180deg, rgba(15, 60, 102, 0.95), rgba(10, 30, 57, 0.93)),
    radial-gradient(circle at top right, rgba(130, 233, 255, 0.3), transparent 30%);
  color: #f7fbff;
}

.auth-hero h2,
.hero h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.05;
}

.auth-hero p,
.hero-copy {
  max-width: 700px;
  font-size: 1.02rem;
  line-height: 1.7;
  color: inherit;
  opacity: 0.9;
}

.auth-card {
  align-self: center;
}

.auth-card-head h3,
.panel-head h3,
.sub-panel-head h4,
.sidebar h1 {
  margin: 0;
}

.auth-card-head p,
.panel-head p,
.sub-panel-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, #82e9ff, #20c4e7);
  color: #0a2745;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badges span,
.status-pill,
.lead-badge,
.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 700;
}

.auth-hero .hero-badges span {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-badges span {
  background: #ffffff;
  border: 1px solid rgba(23, 32, 51, 0.08);
}

.credentials-box,
.sidebar-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(15, 60, 102, 0.03);
}

.credentials-box p {
  margin: 8px 0 0;
}

.flash-message {
  margin-top: 18px;
  padding: 16px 18px;
}

.flash-message.success {
  color: var(--success-text);
  background: var(--success-bg);
  border-color: rgba(22, 101, 52, 0.12);
}

.flash-message.error {
  color: var(--error-text);
  background: var(--error-bg);
  border-color: rgba(185, 28, 28, 0.14);
}

.stack-form {
  margin-top: 18px;
  display: grid;
  gap: 16px;
}

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

.wide {
  grid-column: 1 / -1;
}

label,
.search-box,
.filter-box,
.profile-block {
  display: grid;
  gap: 8px;
}

label span,
.panel-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(15, 60, 102, 0.12);
  border-radius: 14px;
  padding: 14px 15px;
  background: #f9fbff;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(14, 116, 144, 0.6);
  box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.12);
}

textarea {
  resize: vertical;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

.secondary-btn {
  color: #0a2745;
  background: #e4f6fb;
}

.ghost-btn {
  color: var(--primary-deep);
  background: #f1f7ff;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.full-width {
  width: 100%;
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  background: linear-gradient(180deg, rgba(15, 60, 102, 0.96), rgba(10, 30, 57, 0.92));
  color: #f6f9ff;
}

.sidebar .panel-label,
.sidebar small {
  color: rgba(246, 249, 255, 0.74);
}

.profile-block strong,
.sidebar-metric span {
  display: block;
}

.sidebar-metric + .sidebar-metric {
  margin-top: 18px;
}

.sidebar-metric span {
  font-size: 2rem;
  font-weight: 800;
}

.feature-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: rgba(246, 249, 255, 0.84);
}

.logout-form {
  margin-top: 18px;
}

.main-content {
  display: grid;
  gap: 24px;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -45% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 116, 144, 0.18), transparent 68%);
  pointer-events: none;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px;
}

.metric-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-copy strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1;
}

.metric-card span {
  font-size: 1.6rem;
}

.dashboard-grid,
.panel-grid,
.reports-grid {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 26px;
}

.panel-head,
.sub-panel-head,
.toolbar,
.performance-head,
.status-row,
.lead-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.status-pill {
  color: #0a2745;
  background: var(--primary-soft);
}

.panel-grid {
  grid-template-columns: 1fr 1.35fr;
  margin-top: 22px;
}

.reports-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 22px;
}

.reports-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sub-panel {
  padding: 22px;
  border-radius: 24px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
}

thead th {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.performance-list,
.status-report,
.activity-feed,
.lead-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.performance-item,
.status-item,
.activity-item,
.lead-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fcfdff;
}

.performance-item,
.status-item,
.activity-item {
  padding: 16px;
}

.progress-rail {
  margin-top: 12px;
  height: 10px;
  border-radius: 999px;
  background: #eaf2fb;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #4bc6df);
}

.activity-item strong {
  display: block;
}

.activity-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar {
  margin-top: 16px;
  align-items: end;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

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

.lead-card {
  padding: 18px;
}

.lead-card.compact {
  min-height: 0;
}

.lead-card h5 {
  margin: 12px 0 6px;
  font-size: 1.1rem;
}

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

.lead-badge,
.priority-pill {
  padding: 7px 12px;
  font-size: 0.78rem;
}

.lead-badge.New {
  background: #eaf5ff;
  color: #0c6ac7;
}

.lead-badge.Contacted {
  background: #e8fff6;
  color: #157347;
}

.lead-badge.Follow-Up {
  background: #fff2df;
  color: #c26b00;
}

.lead-badge.Qualified {
  background: #ede7ff;
  color: #6f42c1;
}

.lead-badge.Converted {
  background: #d8f5df;
  color: #0b6b33;
}

.priority-pill.High {
  background: #ffe0de;
  color: #b42318;
}

.priority-pill.Medium {
  background: #fff1d6;
  color: #b26b00;
}

.priority-pill.Low {
  background: #e0f6e9;
  color: #0d6f3c;
}

.lead-meta {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.lead-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

.lead-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.inline-form {
  margin: 0;
}

.inline-form button {
  width: 100%;
}

.lead-editor {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.lead-editor summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--primary-deep);
}

.lead-update-form {
  margin-top: 14px;
}

.empty-state {
  padding: 18px;
  text-align: center;
  border-radius: 18px;
  border: 1px dashed rgba(15, 60, 102, 0.18);
  color: var(--muted);
}

@media (max-width: 1320px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 1180px) {
  .auth-shell,
  .page-shell,
  .panel-grid,
  .lead-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 860px) {
  .auth-shell,
  .page-shell {
    padding: 16px;
  }

  .auth-hero,
  .auth-card,
  .sidebar,
  .panel,
  .hero {
    padding: 20px;
    border-radius: 22px;
  }

  .metrics-grid,
  .reports-grid,
  .reports-grid.two-col,
  .input-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .sub-panel-head,
  .toolbar,
  .performance-head,
  .status-row,
  .lead-card-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions,
  .toolbar-actions > * {
    width: 100%;
  }

  .lead-actions {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 620px;
  }
}

@media (max-width: 560px) {
  .auth-shell,
  .page-shell {
    padding: 12px;
    gap: 16px;
  }

  .auth-hero,
  .auth-card,
  .sidebar,
  .panel,
  .hero {
    padding: 16px;
    border-radius: 20px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .hero-badges {
    width: 100%;
  }

  .hero-badges span {
    width: 100%;
    justify-content: center;
  }

  .lead-meta div {
    flex-direction: column;
    align-items: flex-start;
  }
}
