:root {
  color-scheme: light;
  --canvas: #f3f3f3;
  --surface: #ffffff;
  --surface-soft: #fbfbfd;
  --text: #181818;
  --muted: #5f5f5f;
  --line: #e5e5e5;
  --blue: #0176d3;
  --blue-soft: #e8f2ff;
  --green: #2e844a;
  --green-soft: #eaf8ef;
  --amber: #fe9339;
  --amber-soft: #fff4df;
  --red: #ba0517;
  --red-soft: #ffeceb;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --whatsapp: #25d366;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Poppins, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

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

button,
select,
input,
textarea {
  border: 1px solid var(--line);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.25);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--text);
  color: white;
  font-weight: 500;
  letter-spacing: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
  cursor: pointer;
}

.nav button[aria-current="page"] {
  background: var(--text);
  color: white;
}

.nav .icon {
  width: 22px;
  text-align: center;
}

.role-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.role-card select,
.filters select,
.search input {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

.role-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 32px);
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.live-chip {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
}

.live-chip span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.search {
  position: relative;
  display: block;
  width: min(320px, 42vw);
}

.search span {
  position: absolute;
  left: 13px;
  top: 16px;
  color: var(--muted);
}

.search input {
  padding-left: 34px;
  margin-top: 0;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 44px;
  border-radius: 12px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 500;
}

.primary-btn {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.secondary-btn {
  background: var(--surface);
  color: var(--text);
}

.danger-btn {
  background: var(--red-soft);
  color: #8d1712;
  border-color: #ffd1ce;
}

.filters {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 160px minmax(180px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  background: rgba(245, 245, 247, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  margin-bottom: 18px;
}

.health-pill,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.health-pill {
  background: var(--green-soft);
  color: #176b33;
  align-self: center;
}

.view {
  display: grid;
  gap: 18px;
}

.welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.welcome h2 {
  max-width: 760px;
}

.home-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nav-card {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.nav-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.nav-card.compact {
  min-height: 78px;
}

.simple-kpis {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.grid {
  display: grid;
  gap: 16px;
}

.kpis {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card.pad {
  padding: 18px;
}

.kpi {
  min-height: 126px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.kpi em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

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

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 0 10px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
}

.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.person {
  display: grid;
  gap: 2px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font-weight: 500;
  cursor: pointer;
}

.phone-cell,
.actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.action-btn {
  min-height: 30px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.action-btn.whatsapp {
  border-color: rgba(37, 211, 102, 0.35);
  background: rgba(37, 211, 102, 0.1);
  color: #0f6d34;
}

.person small,
.muted {
  color: var(--muted);
}

.pill.hot,
.pill.hot-lead {
  background: var(--red-soft);
  color: #9c1e18;
}

.pill.warm,
.pill.warm-lead {
  background: var(--amber-soft);
  color: #865208;
}

.pill.cold,
.pill.cold-lead {
  background: var(--blue-soft);
  color: #075cae;
}

.pill.invalid,
.pill.invalid-lead,
.pill.duplicate-lead,
.pill.spam {
  background: #eeeeef;
  color: #56565b;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.pipeline-col {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.pipeline-col h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

.lead-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  margin-bottom: 10px;
  cursor: grab;
}

.lead-card span,
.lead-card small {
  color: var(--muted);
}

.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.follow-card {
  min-height: 320px;
}

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

.bucket-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--text);
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 40;
}

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

.pill.good {
  background: var(--green-soft);
  color: #176b33;
}

.pill.due {
  background: var(--amber-soft);
  color: #865208;
}

.pill.overdue {
  background: var(--red-soft);
  color: #9c1e18;
}

.metric-list,
.timeline,
.mapping-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.flow div {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.flow span {
  color: var(--muted);
  font-size: 13px;
}

.metric-row,
.timeline-item,
.mapping-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.timeline-item {
  align-items: flex-start;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--blue);
}

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

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

.form-grid label,
.full {
  display: block;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
}

.form-grid textarea {
  min-height: 92px;
  resize: vertical;
}

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

.digest-preview {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.digest-preview ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.digest-preview li {
  margin: 8px 0;
}

.detail-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(480px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform 180ms ease;
  z-index: 20;
  overflow-y: auto;
  padding: 22px;
}

.detail-panel.open {
  transform: translateX(0);
}

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

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-soft);
  cursor: pointer;
}

.notice {
  padding: 12px;
  border-radius: 12px;
  background: var(--blue-soft);
  color: #075cae;
  font-size: 14px;
}

.forbidden {
  border-color: #ffd1ce;
  background: var(--red-soft);
  color: #9c1e18;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .role-card {
    margin-top: 0;
  }

  .filters,
  .kpis,
  .two-col,
  .three-col,
  .four-col,
  .home-cards,
  .flow {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .topbar-actions,
  .toolbar,
  .welcome {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .filters,
  .kpis,
  .two-col,
  .three-col,
  .four-col,
  .home-cards,
  .flow,
  .form-grid,
  .nav {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr,
  td {
    display: block;
  }

  tr {
    border-top: 1px solid var(--line);
    padding: 8px 0;
  }

  td {
    border: 0;
    padding: 6px 14px;
  }

  td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Reference-style SaaS dashboard theme */
:root {
  --canvas: #f8fafc;
  --surface-soft: #f8fbff;
  --text: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --blue: #0f6bff;
  --blue-soft: #eef6ff;
  --green-soft: #eaf8ee;
  --amber-soft: #fff2e2;
  --purple: #8b5cf6;
  --purple-soft: #f3e8ff;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

body {
  background: var(--canvas);
}

.app-shell {
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  padding: 16px 12px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  gap: 18px;
}

.brand {
  padding: 0 6px 6px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(180deg, #1972ff, #075fe4);
  box-shadow: 0 10px 24px rgba(15, 107, 255, 0.22);
}

.brand strong {
  font-size: 20px;
  letter-spacing: 0;
}

.brand span {
  display: none;
}

.nav {
  gap: 7px;
}

.nav button {
  min-height: 42px;
  border-radius: 8px;
  color: #27344d;
  font-size: 14px;
  font-weight: 500;
  padding: 0 14px;
}

.nav button[aria-current="page"] {
  background: #eef5ff;
  color: #005eea;
}

.nav .icon {
  width: 22px;
  color: currentColor;
  font-size: 17px;
}

.help-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.04);
}

.help-card strong {
  display: block;
  margin-bottom: 8px;
}

.help-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.help-card .secondary-btn {
  width: 100%;
  background: #ffffff;
  min-height: 40px;
  font-size: 13px;
}

.role-card {
  margin-top: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 6px 0;
  background: transparent;
}

.profile-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.avatar,
.top-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #075fe4;
  font-weight: 500;
}

.avatar {
  width: 36px;
  height: 36px;
}

.top-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

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

.profile-row strong {
  font-size: 13px;
}

.profile-row span {
  color: var(--muted);
  font-size: 12px;
}

.role-card label,
.role-card p {
  display: none;
}

.role-card select {
  min-height: 34px;
  margin-top: 0;
  border-radius: 8px;
  font-size: 12px;
  background: #ffffff;
}

.main {
  padding: 0;
  background: #f8fafc;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 62px;
  margin: 0;
  padding: 10px 20px 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.topbar-actions {
  width: 100%;
  justify-content: space-between;
  gap: 12px;
}

.search {
  width: min(472px, 40vw);
}

.search input,
.top-filter select {
  min-height: 38px;
  border-radius: 8px;
  border-color: #d9e2ef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.search input {
  padding-left: 38px;
  color: #334155;
}

.search span {
  top: 10px;
  left: 14px;
}

.top-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 148px;
  min-height: 38px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #ffffff;
  padding: 0 10px;
  color: #0f172a;
}

.top-filter select {
  width: 100%;
  min-height: 36px;
  margin: 0;
  border: 0;
  padding: 0 22px 0 0;
  background: transparent;
  font-weight: 500;
}

.icon-top {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  color: #172554;
  cursor: pointer;
}

.icon-top span {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  min-height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
}

.view {
  padding: 28px 32px;
  gap: 18px;
}

.welcome {
  padding: 0;
  border: 0;
  background: transparent;
}

.welcome h2 {
  max-width: none;
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 500;
}

.welcome p {
  margin: 8px 0 0;
  color: #34445d;
}

.home-cards {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}

.nav-card {
  position: relative;
  min-height: 102px;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 20px;
  border-color: #dfe7f1;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.035);
}

.nav-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.nav-card em {
  position: absolute;
  right: 18px;
  top: 18px;
  min-width: 22px;
  min-height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.card-copy {
  display: grid;
  gap: 5px;
}

.card-copy strong {
  color: var(--text);
  font-size: 15px;
}

.card-copy small {
  max-width: 180px;
  color: #34445d;
  font-size: 13px;
  line-height: 1.45;
}

.card-icon,
.mini-icon {
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-weight: 500;
  flex: 0 0 auto;
}

.card-icon {
  width: 50px;
  height: 50px;
  font-size: 25px;
}

.mini-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 16px;
}

.blue {
  background: #eaf3ff;
  color: #0f6bff;
}

.green {
  background: #eaf8ee;
  color: #14813a;
}

.orange {
  background: #fff2e2;
  color: #f97316;
}

.purple {
  background: #f3e8ff;
  color: #7c3aed;
}

.gray {
  background: #f1f5f9;
  color: #64748b;
}

.whatsapp {
  background: #e8f8ed;
  color: #128c3a;
}

.simple-kpis {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}

.home-kpi {
  min-height: 130px;
  padding: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px;
  border-color: #dfe7f1;
}

.home-kpi span {
  color: #34445d;
  font-size: 14px;
  font-weight: 500;
}

.home-kpi strong {
  display: block;
  margin-top: 10px;
  font-size: 27px;
  line-height: 1;
}

.home-kpi small {
  display: block;
  margin-top: 12px;
  color: #059669;
  font-weight: 500;
}

.home-kpi em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.dashboard-bottom {
  grid-template-columns: minmax(420px, 0.95fr) minmax(480px, 1.05fr);
  gap: 20px;
  align-items: start;
}

.activity-card {
  min-height: 410px;
}

.activity-card h2,
.performance-card h2,
.crm-hero h2 {
  font-size: 16px;
}

.activity-list {
  margin-top: 12px;
}

.activity-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.activity-row strong,
.activity-row small {
  display: block;
}

.activity-row strong {
  font-size: 13px;
}

.activity-row small,
.activity-row time {
  color: #475569;
  font-size: 12px;
}

.text-link {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: #005eea;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.right-stack {
  display: grid;
  gap: 20px;
}

.crm-hero {
  min-height: 256px;
  display: grid;
  grid-template-columns: minmax(180px, 0.48fr) minmax(260px, 0.52fr);
  align-items: center;
  gap: 18px;
  padding: 30px;
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #f8fbff 0%, #edf6ff 100%);
}

.crm-hero p {
  color: #34445d;
  max-width: 260px;
}

.mock-window {
  position: relative;
  min-height: 180px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 55px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.mock-bar {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  background: #334155;
}

.mock-bar span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
}

.mock-bar span:nth-child(2) {
  background: #fcd34d;
}

.mock-bar span:nth-child(3) {
  background: #e5e7eb;
}

.mock-table {
  display: grid;
  grid-template-columns: 0.35fr 1fr 1fr 0.5fr;
  gap: 13px 18px;
  padding: 24px;
}

.mock-table i {
  height: 3px;
  border-radius: 999px;
  background: #a8b3c7;
}

.mock-window b {
  position: absolute;
  right: -12px;
  top: -14px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0f6bff;
  color: #ffffff;
  font-size: 22px;
  box-shadow: 0 10px 24px rgba(15, 107, 255, 0.28);
}

.performance-card {
  border-radius: 8px;
}

.performance-card .toolbar {
  margin-bottom: 20px;
}

.performance-card h2 span {
  color: #475569;
  font-size: 13px;
  font-weight: 500;
}

.perf-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.perf-grid div {
  padding: 0 20px;
  border-left: 1px solid var(--line);
}

.perf-grid div:first-child {
  padding-left: 0;
  border-left: 0;
}

.perf-grid span {
  display: block;
  color: #475569;
  font-size: 12px;
}

.perf-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.section-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.section-hero h2 {
  margin: 0;
  font-size: 24px;
}

.section-hero p {
  margin: 6px 0 0;
  max-width: 720px;
  color: #475569;
}

.section-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-stats div {
  min-width: 112px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

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

.section-stats span {
  color: #64748b;
  font-size: 12px;
}

.section-stats strong {
  margin-top: 4px;
  font-size: 18px;
}

.control-panel {
  background: #ffffff;
}

.bulk-bar,
.assignment-rule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.bulk-bar span,
.assignment-rule-row span {
  margin-right: auto;
  color: #475569;
  font-size: 13px;
}

.pipeline-col h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pipeline-col h2 span {
  min-width: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef5ff;
  color: #005eea;
  font-size: 12px;
}

.form-grid input,
.form-grid textarea {
  border: 1px solid var(--line);
}

.env-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow-x: auto;
}

.env-box pre {
  margin: 0;
  padding: 14px;
  color: #0f172a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.mini-warning {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .dashboard-bottom,
  .crm-hero {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .search {
    width: 100%;
  }

  .section-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .section-stats {
    justify-content: flex-start;
  }
}

/* Softer typography pass */
body {
  font-family: "Helvetica Neue", Helvetica, Poppins, Inter, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0;
}

strong,
b {
  font-weight: 500;
}

h1,
h2,
h3,
.welcome h2,
.brand strong,
.home-kpi strong,
.perf-grid strong,
.kpi strong {
  font-weight: 500;
}

label,
.nav button,
.primary-btn,
.secondary-btn,
.danger-btn,
.segmented button,
.pill,
.health-pill,
.live-chip,
.action-btn,
.text-link,
.card-copy strong,
.profile-row strong,
.top-filter select,
.home-kpi small,
.nav-card em,
.icon-top span {
  font-weight: 500;
}

.brand-mark,
.avatar,
.top-avatar,
.card-icon,
.mini-icon {
  font-weight: 500;
}

.welcome h2 {
  font-size: 27px;
}

.home-kpi strong {
  font-size: 26px;
}

.card-copy strong,
.activity-row strong {
  font-weight: 500;
}

/* Screen optimization: desktop, laptop, tablet, mobile */
html {
  min-width: 0;
}

body {
  overflow-x: hidden;
}

.main,
.view,
.card,
.table-wrap,
.pipeline,
.topbar-actions {
  min-width: 0;
}

.table-wrap,
.pipeline {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.top-filter,
.search,
.primary-btn,
.secondary-btn {
  flex-shrink: 0;
}

@media (min-width: 1600px) {
  .view {
    max-width: 1500px;
    margin: 0 auto;
    width: 100%;
  }

  .home-cards,
  .simple-kpis {
    grid-template-columns: repeat(4, minmax(240px, 1fr));
  }
}

@media (max-width: 1440px) {
  .view {
    padding: 24px;
  }

  .home-cards {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
  }

  .nav-card {
    gap: 14px;
    padding: 16px;
  }

  .dashboard-bottom {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
  }
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    padding: 14px 10px;
  }

  .topbar {
    padding: 10px 16px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(140px, auto)) 38px 34px;
    align-items: center;
  }

  .search {
    width: 100%;
  }

  .home-cards,
  .simple-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-bottom,
  .two-col,
  .crm-hero {
    grid-template-columns: 1fr;
  }

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

  .pipeline {
    grid-template-columns: repeat(7, minmax(210px, 1fr));
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    padding-bottom: 0;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav button {
    white-space: nowrap;
  }

  .help-card {
    display: none;
  }

  .role-card {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px);
    gap: 12px;
    align-items: center;
    border-top: 0;
    padding: 0 6px 4px;
  }

  .role-card select {
    width: 100%;
  }

  .topbar {
    position: static;
  }

  .topbar-actions {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.55fr) minmax(150px, 0.55fr);
  }

  .top-filter:nth-of-type(3),
  .icon-top,
  .top-avatar {
    display: none;
  }

  .view {
    padding: 20px;
  }

  .section-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .section-stats {
    justify-content: flex-start;
  }

  .perf-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .perf-grid div {
    padding: 0;
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .sidebar {
    gap: 12px;
  }

  .brand strong {
    font-size: 18px;
  }

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

  .nav button {
    min-height: 40px;
    font-size: 13px;
  }

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

  .profile-row {
    margin-bottom: 0;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .top-filter,
  .search {
    width: 100%;
    min-width: 0;
  }

  .top-filter:nth-of-type(3),
  .icon-top,
  .top-avatar {
    display: none;
  }

  .view {
    padding: 16px;
    gap: 14px;
  }

  .welcome h2,
  .section-hero h2 {
    font-size: 22px;
  }

  .welcome p,
  .section-hero p {
    font-size: 14px;
  }

  .home-cards,
  .simple-kpis,
  .three-col,
  .four-col,
  .admin-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .nav-card {
    min-height: 92px;
    align-items: center;
  }

  .home-kpi {
    min-height: 110px;
    padding: 18px;
  }

  .dashboard-bottom,
  .right-stack,
  .two-col,
  .crm-hero {
    grid-template-columns: 1fr;
  }

  .crm-hero {
    padding: 20px;
  }

  .mock-window {
    min-height: 150px;
  }

  .activity-row {
    grid-template-columns: 34px 1fr;
    align-items: start;
  }

  .activity-row time {
    grid-column: 2;
  }

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

  .section-stats div {
    min-width: 0;
  }

  .bulk-bar,
  .assignment-rule-row,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-bar span,
  .assignment-rule-row span {
    margin-right: 0;
  }

  .bulk-bar button,
  .toolbar button,
  .segmented {
    width: 100%;
  }

  .segmented {
    overflow-x: auto;
  }

  .pipeline {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .pipeline-col {
    min-width: 82vw;
    scroll-snap-align: start;
  }

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

  .detail-panel {
    width: 100vw;
    border-left: 0;
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding: 12px;
  }

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

  .view {
    padding: 12px;
  }

  .card.pad,
  .section-hero,
  .home-kpi,
  .nav-card {
    padding: 14px;
  }

  .card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 20px;
  }

  .home-kpi strong {
    font-size: 22px;
  }

  .section-stats,
  .perf-grid {
    grid-template-columns: 1fr;
  }

  .mock-window {
    display: none;
  }

  .crm-hero {
    min-height: auto;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr,
  td {
    display: block;
  }

  tr {
    padding: 10px 0;
    border-top: 1px solid var(--line);
  }

  td {
    padding: 6px 0;
    border: 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
  }

  .actions,
  .phone-cell {
    gap: 5px;
  }

  .action-btn {
    min-height: 32px;
    padding: 0 7px;
  }
}

/* Premium CRM refinement */
body, button, input, select, textarea { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
:root { --blue: #6e56cf; --blue-soft: #f0edff; --canvas: #fafafb; --line: #ececec; --green: #22c55e; --amber: #f59e0b; --red: #ef4444; }
.app-shell { grid-template-columns: 220px minmax(0,1fr); }
.sidebar { display: flex; align-items: stretch; padding: 18px 12px; }
.sidebar .brand { order: -3; justify-content: flex-start; padding: 0 8px; }
.sidebar .brand > div:last-child { display: block; }
.sidebar .brand strong { font-size: 15px; font-weight: 600; }
.role-card { order: -2; margin: 2px 0 4px; padding: 12px 8px; border: 0; border-radius: 8px; background: #fafafb; }
.profile-row { justify-content: flex-start; margin: 0; }
.profile-row > div:last-child { display: block; min-width: 0; }
.profile-row strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { order: 0; gap: 3px; }
.nav button { justify-content: flex-start; min-height: 40px; gap: 11px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.nav button::after { display: none; }
.nav .icon { width: 20px; display: grid; place-items: center; }
.nav-label { display: inline; }
.nav button[aria-current="page"] { box-shadow: none; background: #f0edff; }
.sidebar .logout-btn { margin-top: auto; width: 100%; display: flex; justify-content: flex-start; gap: 8px; padding: 0 11px; font-size: 12px; }
.sidebar .logout-btn::before { font-size: 16px; }
.main { background: #fafafb; }
.view { max-width: 1540px; padding: 24px 28px 48px; }
.leads-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.leads-header h2 { font-size: 25px; font-weight: 600; }
.leads-header p:not(.eyebrow) { margin: 5px 0 0; color: #77727f; font-size: 13px; }
.leads-header .primary-btn { display: inline-flex; align-items: center; gap: 7px; }
.lead-kpi-strip { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.lead-kpi { min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border: 0; border-right: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; }
.lead-kpi:last-child { border-right: 0; }
.lead-kpi:hover, .lead-kpi.active { background: #faf9ff; }
.lead-kpi.active { box-shadow: inset 0 -2px #6e56cf; }
.lead-kpi span { color: #77727f; font-size: 11px; }
.lead-kpi strong { font-size: 22px; font-weight: 600; }
.compact-filter-bar { position: sticky; top: 70px; z-index: 8; display: grid; grid-template-columns: minmax(240px,1fr) repeat(3,150px) auto 38px; align-items: center; gap: 8px; padding: 10px; border-radius: 8px; box-shadow: 0 8px 20px rgba(35,29,48,.04); }
.lead-search { position: relative; display: flex; align-items: center; }
.lead-search > svg { position: absolute; left: 12px; color: #8e8896; }
.lead-search input, .compact-filter-bar select { width: 100%; min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #3e3945; font-size: 12px; }
.lead-search input { padding-left: 36px; }
.filter-button, .icon-action { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #504a58; cursor: pointer; font-size: 12px; }
.filter-button { padding: 0 12px; }
.filter-button span { min-width: 18px; height: 18px; display: grid; place-items: center; border-radius: 9px; background: #f0edff; color: #6e56cf; font-size: 10px; }
.icon-action { width: 38px; }
.advanced-filters { position: fixed; top: 0; right: 0; z-index: 60; width: min(420px,100vw); height: 100vh; padding: 24px; border-radius: 0; box-shadow: -20px 0 60px rgba(30,24,42,.13); }
.drawer-title { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.drawer-title h3 { font-size: 18px; }.drawer-title p { margin: 5px 0 0; color: #77727f; font-size: 12px; }
.advanced-filters .form-grid { margin-top: 20px; }.advanced-filters .drawer-actions { position: absolute; left: 24px; right: 24px; bottom: 24px; display: flex; justify-content: flex-end; gap: 8px; }
.lead-inbox { overflow: visible; }
.inbox-toolbar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.inbox-toolbar h3 { font-size: 14px; font-weight: 600; }.inbox-toolbar span { color: #8b8591; font-size: 10px; }
.modern-lead-list { display: grid; }
.modern-lead { position: relative; display: grid; grid-template-columns: minmax(220px,1.15fr) minmax(220px,1.2fr) minmax(150px,.7fr) minmax(130px,.6fr) auto; align-items: center; gap: 18px; min-height: 96px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; transition: background .16s ease, box-shadow .16s ease; }
.modern-lead:last-child { border-bottom: 0; }
.modern-lead:hover { z-index: 2; background: #fdfcff; box-shadow: 0 8px 24px rgba(40,30,60,.07); }
.lead-person { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 11px; align-items: start; }
.lead-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #eeeaff; color: #6e56cf; font-size: 11px; font-weight: 600; }
.lead-name { display: block; padding: 0; border: 0; background: transparent; color: #24202a; font-size: 13px; font-weight: 600; cursor: pointer; }
.lead-person span { margin-top: 4px; display: flex; align-items: center; gap: 5px; color: #79737f; font-size: 10px; }
.lead-context strong, .lead-context span, .lead-context small, .lead-owner span, .lead-owner strong, .lead-owner small { display: block; }
.lead-context strong, .lead-owner strong { color: #39343f; font-size: 11px; font-weight: 600; }
.lead-context span { margin-top: 5px; color: #65606c; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-context small, .lead-owner small { margin-top: 4px; color: #99939e; font-size: 9px; }
.lead-owner > span { margin-bottom: 4px; color: #99939e; font-size: 9px; text-transform: uppercase; }
.lead-state { display: grid; justify-items: start; gap: 6px; }
.stage-pill { color: #6f6975; font-size: 10px; }
.lead-quick-actions { display: flex; align-items: center; gap: 5px; opacity: .45; transition: opacity .16s ease; }
.modern-lead:hover .lead-quick-actions { opacity: 1; }
.quick-action { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #57515e; cursor: pointer; font-size: 10px; white-space: nowrap; }
.quick-action:hover { border-color: #cfc5ef; color: #6e56cf; }
.quick-action.whatsapp-action { color: #168c45; }.quick-action.icon-only { width: 34px; padding: 0; justify-content: center; }
.more-wrap { position: relative; }
.more-menu { position: absolute; top: 40px; right: 0; z-index: 20; width: 150px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 16px 40px rgba(29,23,39,.14); }
.more-menu button { width: 100%; min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: #4c4652; font-size: 11px; cursor: pointer; }
.more-menu button:hover { background: #f5f2fc; color: #6e56cf; }
.fab-wrap { position: fixed; right: 28px; bottom: 28px; z-index: 30; }
.fab { width: 50px; height: 50px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #6e56cf; color: #fff; box-shadow: 0 12px 28px rgba(110,86,207,.3); cursor: pointer; }
.fab-menu { position: absolute; right: 0; bottom: 60px; width: 180px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 16px 40px rgba(29,23,39,.14); }
.fab-menu button { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: #49434f; font-size: 11px; cursor: pointer; }.fab-menu button:hover { background: #f5f2fc; }
.detail-panel { width: min(440px,100vw); padding: 0; background: #fafafb; }
.modern-panel-header { padding: 24px; background: #fff; border-bottom: 1px solid var(--line); }
.modern-panel-header h2 { display: inline-block; margin-right: 8px; font-size: 21px; font-weight: 600; }
.drawer-contact-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; padding: 16px 20px 0; }
.drawer-contact-actions button { min-height: 48px; display: grid; place-items: center; gap: 3px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #55505c; cursor: pointer; font-size: 10px; }.drawer-contact-actions .whatsapp-action { color: #168c45; }
.drawer-summary { margin: 16px 20px 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.drawer-summary div { padding: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }.drawer-summary div:nth-child(2n){border-right:0}.drawer-summary div:nth-last-child(-n+2){border-bottom:0}
.drawer-summary span, .drawer-summary strong { display: block; }.drawer-summary span { color:#99939e;font-size:9px;text-transform:uppercase}.drawer-summary strong { margin-top:4px;font-size:10px;overflow-wrap:anywhere }
.detail-panel .stack { padding-bottom: 24px; }.detail-panel .stack > .card { margin: 16px 20px 0; box-shadow: none; }

@media (max-width: 1200px) {
  .compact-filter-bar { grid-template-columns: minmax(220px,1fr) repeat(2,140px) auto 38px; }.compact-filter-bar select:nth-of-type(3){display:none}
  .modern-lead { grid-template-columns: minmax(210px,1fr) minmax(190px,1fr) 130px auto; }.lead-owner{display:none}.quick-action span{display:none}
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 78px minmax(0,1fr); }.sidebar .brand > div:last-child,.profile-row > div:last-child,.nav-label{display:none}.sidebar .brand,.profile-row,.nav button{justify-content:center}.role-card{background:transparent}.sidebar .logout-btn{justify-content:center;font-size:0}
  .lead-kpi-strip { grid-template-columns: repeat(5,150px); overflow-x:auto }.compact-filter-bar{grid-template-columns:1fr auto 38px}.compact-filter-bar select{display:none!important}
  .modern-lead { grid-template-columns: minmax(220px,1fr) minmax(180px,.9fr) auto; }.lead-state{display:none}
}
@media (max-width: 650px) {
  .app-shell{grid-template-columns:1fr}.sidebar .brand > div:last-child,.profile-row > div:last-child,.nav-label{display:block}.sidebar .brand,.profile-row,.nav button{justify-content:flex-start}.sidebar .logout-btn{justify-content:flex-start;font-size:12px}
  .leads-header{align-items:flex-start}.lead-kpi-strip{grid-template-columns:repeat(5,130px)}.lead-kpi{min-height:66px;padding:10px 12px}.lead-kpi strong{font-size:18px}
  .modern-lead { display:grid; grid-template-columns:1fr auto; gap:12px; padding:16px }.lead-person{grid-column:1}.lead-state{display:grid;grid-column:2;grid-row:1}.lead-context{grid-column:1/-1}.lead-owner{display:block;grid-column:1}.lead-quick-actions{grid-column:1/-1;opacity:1}.quick-action span{display:inline}.inbox-toolbar{align-items:flex-start;flex-direction:column}.segmented{width:100%;overflow-x:auto}
}

/* Adflux-inspired analytics theme */
:root {
  --canvas: #f7f7fb;
  --surface: #ffffff;
  --surface-soft: #faf9ff;
  --text: #171521;
  --muted: #6f6a7a;
  --line: #e8e5ed;
  --blue: #7847df;
  --blue-soft: #f1ebff;
  --purple: #7847df;
  --purple-soft: #f1ebff;
  --green: #1da879;
  --shadow: 0 10px 30px rgba(44, 35, 66, 0.055);
}

body { background: var(--canvas); color: var(--text); }
.app-shell { grid-template-columns: 92px minmax(0, 1fr); }
.sidebar { padding: 18px 14px; gap: 20px; align-items: center; background: #fff; }
.brand { padding: 0; justify-content: center; }
.brand-mark { width: 42px; height: 42px; border-radius: 8px; background: #7847df; box-shadow: 0 8px 20px rgba(120, 71, 223, .2); }
.brand > div:last-child { display: none; }
.nav { width: 100%; gap: 9px; }
.nav button { position: relative; width: 100%; min-height: 48px; justify-content: center; padding: 0; border-radius: 8px; font-size: 0; color: #625d6c; }
.nav button:hover { background: #f7f4fd; color: #7847df; }
.nav button[aria-current="page"] { background: #f1ebff; color: #7847df; box-shadow: inset 0 0 0 1px #dfd0ff; }
.nav .icon { width: auto; font-size: 20px; }
.nav button::after { content: attr(data-view); position: absolute; left: 62px; z-index: 40; padding: 7px 9px; border-radius: 6px; background: #211d2a; color: #fff; font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateX(-4px); transition: .18s ease; }
.nav button:hover::after { opacity: 1; transform: translateX(0); }
.help-card { display: none; }
.role-card { width: 100%; margin-top: auto; padding: 14px 0 0; border-top: 1px solid var(--line); }
.profile-row { display: flex; justify-content: center; margin: 0; }
.profile-row > div:last-child, .role-card select { display: none; }
.avatar { width: 38px; height: 38px; background: #eee8fb; color: #7847df; }
.main { background: var(--canvas); }
.topbar { min-height: 70px; padding: 14px 28px; border-bottom-color: var(--line); background: rgba(255,255,255,.96); }
.search { width: min(520px, 42vw); }
.search input, .top-filter, .top-filter select, .icon-top { border-color: var(--line); box-shadow: none; }
.search input:focus, .top-filter:focus-within { border-color: #bca4ef; outline-color: rgba(120,71,223,.16); }
.view { max-width: 1680px; margin: 0 auto; padding: 30px 34px 44px; gap: 20px; }
.welcome { display: flex; align-items: end; justify-content: space-between; }
.welcome h2 { font-size: 26px; font-weight: 500; }
.welcome p { color: var(--muted); }
.primary-btn { background: #7847df; border-color: #7847df; box-shadow: 0 6px 16px rgba(120,71,223,.16); }
.primary-btn:hover { background: #6938cf; }
.secondary-btn { border-color: var(--line); }
.card, .nav-card, .home-kpi, .section-hero { border-color: var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.home-cards { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.nav-card { min-height: 78px; padding: 14px; gap: 12px; }
.card-icon { width: 42px; height: 42px; border-radius: 8px; font-size: 19px; }
.card-copy strong { font-size: 14px; }
.card-copy small { font-size: 12px; }
.simple-kpis { gap: 12px; }
.home-kpi { position: relative; min-height: 120px; padding: 18px; overflow: hidden; }
.home-kpi::after { content: ""; position: absolute; right: 18px; bottom: 20px; width: 72px; height: 32px; border-bottom: 2px solid #7847df; border-radius: 50%; transform: skewY(-12deg); opacity: .38; }
.home-kpi:nth-child(2)::after { border-color: #ec685d; transform: skewY(11deg); }
.home-kpi:nth-child(3)::after { border-color: #1da879; transform: skewY(-8deg); }
.home-kpi:nth-child(4)::after { border-color: #ec8ecf; transform: skewY(-4deg); }
.home-kpi > .card-icon { align-self: flex-start; }
.home-kpi strong { font-size: 29px; font-weight: 500; }
.analytics-workspace { padding: 22px; }
.analytics-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.analytics-head h2 { font-size: 21px; font-weight: 500; }
.analytics-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.analytics-filters { display: flex; gap: 8px; }
.analytics-filters button { min-height: 38px; }
.analytics-grid { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 20px; padding-top: 20px; }
.audience-panel { padding-right: 20px; border-right: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-title span { color: var(--muted); font-size: 12px; }
.donut-chart { width: 168px; height: 168px; margin: 20px auto; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#7847df 0 38%, #ec8ecf 38% 68%, #e8e5ed 68% 100%); }
.donut-chart::before { content: ""; grid-area: 1/1; width: 102px; height: 102px; border-radius: 50%; background: #fff; }
.donut-chart div { grid-area: 1/1; z-index: 1; text-align: center; }
.donut-chart strong, .donut-chart span { display: block; }
.donut-chart strong { font-size: 24px; font-weight: 500; }
.donut-chart span { color: var(--muted); font-size: 11px; }
.chart-legend { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 7px; height: 7px; border-radius: 50%; }
.legend-purple { background: #7847df; }.legend-pink { background: #ec8ecf; }.legend-gray { background: #d9d5df; }.legend-green { background: #1da879; }.legend-orange { background: #efa561; }
.trend-panel { min-width: 0; }
.trend-chart { display: block; width: 100%; height: 220px; margin-top: 12px; overflow: visible; }
.chart-grid line { stroke: #ece9f0; stroke-width: 1; }
.line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.leads-line { stroke: #7847df; }.qualified-line { stroke: #1da879; }.booked-line { stroke: #efa561; }
.chart-axis { display: flex; justify-content: space-between; padding: 0 14px; color: #8a8491; font-size: 10px; }
.dashboard-bottom { gap: 16px; }
.crm-hero { border-color: #ded2f4; background: #faf8ff; }
.mock-window b { background: #7847df; }
.text-link { color: #7847df; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 78px minmax(0,1fr); }
  .home-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .analytics-grid { grid-template-columns: 240px minmax(0,1fr); }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { align-items: stretch; }
  .brand > div:last-child { display: block; }
  .nav button { justify-content: flex-start; padding: 0 12px; font-size: 13px; }
  .nav button::after { display: none; }
  .profile-row { justify-content: flex-start; }
  .profile-row > div:last-child { display: block; }
  .analytics-head, .analytics-filters { align-items: stretch; flex-direction: column; }
  .analytics-grid { grid-template-columns: 1fr; }
  .audience-panel { padding: 0 0 20px; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 520px) {
  .view { padding: 18px 12px 30px; }
  .home-cards { grid-template-columns: 1fr; }
  .analytics-workspace { padding: 16px; }
  .trend-chart { height: 170px; }
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #f5f3fa;
}

.auth-shell {
  width: min(1180px, 100%);
  min-height: min(760px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, .85fr);
  overflow: hidden;
  border: 1px solid #e5dfed;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(42, 30, 66, .12);
}

.auth-visual {
  position: relative;
  min-width: 0;
  padding: 34px 38px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #eeeafb;
}

.auth-brand, .auth-mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.auth-brand .brand-mark, .auth-mobile-brand .brand-mark { width: 36px; height: 36px; }
.auth-visual-copy { max-width: 510px; margin-top: 42px; position: relative; z-index: 1; }
.auth-visual-copy > span { color: #7847df; font-size: 12px; font-weight: 500; text-transform: uppercase; }
.auth-visual-copy h2 { margin-top: 10px; font-size: 34px; line-height: 1.14; font-weight: 500; }
.auth-visual-copy p { max-width: 480px; margin: 12px 0 0; color: #615b6c; font-size: 14px; }
.auth-visual img { width: calc(100% + 12px); max-height: 390px; margin: auto -6px 18px; object-fit: contain; mix-blend-mode: multiply; }
.auth-proof { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.auth-proof span { padding: 12px; border: 1px solid rgba(120,71,223,.16); border-radius: 8px; background: rgba(255,255,255,.54); color: #6b6575; font-size: 11px; }
.auth-proof strong { display: block; margin-bottom: 2px; color: #211d29; font-size: 15px; font-weight: 500; }
.auth-mobile-brand { display: none; }

.auth-panel {
  width: 100%;
  max-width: 480px;
  margin: auto;
  padding: 48px 52px;
  background: #fff;
}

.auth-panel > .eyebrow { color: #7847df; }
.auth-panel h1 { margin: 8px 0 8px; font-size: 31px; font-weight: 500; }
.auth-panel > .muted { margin: 0; color: #746e7d; font-size: 13px; }
.social-auth { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-top: 24px; }
.social-auth button { min-height: 43px; display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: 7px; background: #fff; color: #332e3c; cursor: pointer; }
.social-auth button:hover { border-color: #bda8eb; background: #faf8ff; }
.social-auth b { font-size: 16px; }.social-auth button:nth-child(1) b { color: #4285f4; }.social-auth button:nth-child(2) b { color: #1877f2; font-size: 20px; }.social-auth button:nth-child(3) b { color: #111; }
.social-auth span { font-size: 12px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #97919d; font-size: 10px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.auth-form, .auth-form label, #registerFields { display: grid; gap: 7px; }
.auth-form { gap: 14px; margin-top: 0; }
#registerFields { gap: 14px; }
.auth-form label > span { color: #46404e; font-size: 11px; font-weight: 500; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > i { position: absolute; left: 13px; z-index: 1; color: #8b8494; font-style: normal; font-size: 13px; }
.auth-form .input-wrap input { width: 100%; min-height: 44px; padding: 0 42px 0 38px; border: 1px solid var(--line); border-radius: 7px; background: #fcfbfd; font: inherit; font-size: 13px; }
.auth-form input:focus { outline: 2px solid rgba(120,71,223,.13); border-color: #9d7de3; background: #fff; }
.input-wrap > button { position: absolute; right: 7px; width: 32px; height: 32px; border: 0; background: transparent; color: #8b8494; cursor: pointer; }
.login-options { display: flex; justify-content: space-between; align-items: center; }
.login-options label { display: flex; align-items: center; gap: 7px; color: #6d6676; font-size: 11px; }
.login-options input { width: 14px; height: 14px; accent-color: #7847df; }
.login-options button { border: 0; background: transparent; color: #7847df; font-size: 11px; cursor: pointer; }
.auth-error { min-height: 18px; margin: 0; color: #c62828; font-size: 13px; }
.auth-submit { width: 100%; min-height: 46px; }
.auth-switch { margin: 20px 0 0; text-align: center; color: #797281; font-size: 12px; }
.auth-switch button { border: 0; background: transparent; color: #7847df; font-weight: 500; cursor: pointer; }
.auth-terms { margin: 24px 0 0; text-align: center; color: #a19aa8; font-size: 9px; }
.logout-btn { width: 100%; margin-top: 12px; }
.sidebar .logout-btn { display: grid; place-items: center; width: 38px; min-height: 34px; margin: 10px auto 0; padding: 0; border: 0; background: transparent; color: #746e7d; font-size: 0; box-shadow: none; }
.sidebar .logout-btn::before { content: "↪"; font-size: 18px; }
.sidebar .logout-btn:hover { background: #f1ebff; color: #7847df; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .auth-screen { padding: 18px; }
  .auth-shell { grid-template-columns: 1fr; max-width: 560px; }
  .auth-visual { display: none; }
  .auth-mobile-brand { display: flex; margin-bottom: 42px; }
  .auth-panel { max-width: 500px; padding: 38px 46px; }
}

@media (max-width: 520px) {
  .auth-screen { align-items: start; padding: 0; background: #fff; }
  .auth-shell { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .auth-panel { padding: 26px 20px 30px; }
  .auth-mobile-brand { margin-bottom: 46px; }
  .social-auth span { display: none; }
  .auth-panel h1 { font-size: 28px; }
}

/* Final shell overrides: labeled navigation and Inter CRM density */
body, button, input, select, textarea { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.app-shell { grid-template-columns: 220px minmax(0,1fr); }
.sidebar { align-items: stretch; padding: 18px 12px; }
.sidebar .brand { order: -3; justify-content: flex-start; padding: 0 8px; }
.sidebar .brand > div:last-child { display: block; }
.sidebar .brand strong { font-size: 15px; }
.sidebar .role-card { order: -2; width: auto; margin: 2px 0 4px; padding: 12px 8px; border: 0; border-radius: 8px; background: #fafafb; }
.sidebar .profile-row { justify-content: flex-start; margin: 0; }
.sidebar .profile-row > div:last-child { display: block; }
.sidebar .nav { order: 0; gap: 3px; }
.sidebar .nav button { justify-content: flex-start; min-height: 40px; gap: 11px; padding: 0 10px; font-size: 13px; }
.sidebar .nav .icon { width: 20px; }
.sidebar .nav-label { display: inline; }
.sidebar .logout-btn { margin-top: auto; width: 100%; display: flex; justify-content: flex-start; gap: 8px; padding: 0 11px; font-size: 12px; }
.main { background: #fafafb; }
.view { max-width: 1540px; padding: 24px 28px 48px; }
.primary-btn { background: #6e56cf; border-color: #6e56cf; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 78px minmax(0,1fr); }
  .sidebar .brand > div:last-child, .sidebar .profile-row > div:last-child, .sidebar .nav-label { display: none; }
  .sidebar .brand, .sidebar .profile-row, .sidebar .nav button { justify-content: center; }
  .sidebar .role-card { background: transparent; }
  .sidebar .logout-btn { justify-content: center; font-size: 0; }
}

@media (max-width: 650px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar .brand > div:last-child, .sidebar .profile-row > div:last-child, .sidebar .nav-label { display: block; }
  .sidebar .brand, .sidebar .profile-row, .sidebar .nav button { justify-content: flex-start; }
  .sidebar .logout-btn { justify-content: flex-start; font-size: 12px; }
}
