:root {
  --navy: #0b0711;
  --navy-2: #1c1029;
  --blue: #7600ff;
  --sky: #f1e7ff;
  --ink: #18121f;
  --muted: #716a79;
  --line: #e8e2ed;
  --bg: #f7f5fa;
}

.topbar {
  position: relative;
  height: 76px;
  background: #0b0711;
  border-bottom: 1px solid #ffffff17;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, #7600ff 0 36%, #45ff00 64%, #ff5500 100%);
}

.brand img {
  display: block;
  width: auto;
  object-fit: contain;
}

.topbar-brand {
  gap: 14px;
}

.topbar-brand img {
  height: 36px;
  max-width: 150px;
}

.topbar-brand span,
.auth-brand span {
  padding-left: 13px;
  border-left: 1px solid currentColor;
  font-size: .76rem;
  letter-spacing: .14em;
  opacity: .65;
}

.auth-brand img {
  height: 46px;
  max-width: 190px;
}

.primary {
  background: #7600ff;
  box-shadow: 0 7px 18px #7600ff30;
}

.primary:hover {
  background: #6200d6;
  box-shadow: 0 9px 22px #7600ff3d;
}

.secondary {
  color: #382a48;
  border-color: #ded4e8;
}

.secondary:hover {
  border-color: #9e72ce;
  color: #7600ff;
}

.eyebrow,
.row-action,
.file-drop strong {
  color: #7600ff;
}

.stat.active,
.stat:hover {
  border-color: #b88cff;
  box-shadow: 0 8px 24px #7600ff10;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #7600ff;
  box-shadow: 0 0 0 3px #efe3ff;
}

.stage-novo {
  background: #f0e5ff;
  color: #6500dc;
}

.stage-em-contato {
  background: #fff0e8;
  color: #bb3e00;
}

.stage-proposta {
  background: #f3eaff;
  color: #53208c;
}

.stage-ganho {
  background: #e9ffe1;
  color: #1e7400;
}

.auth-body {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 15%, #7600ff4a, transparent 34%),
    radial-gradient(circle at 82% 80%, #ff55002e, transparent 28%),
    #0b0711;
}

.auth-body::before {
  content: "";
  position: fixed;
  width: 55vw;
  height: 55vw;
  max-width: 760px;
  max-height: 760px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: linear-gradient(#0b0711, #0b0711) padding-box,
    linear-gradient(135deg, #7600ff, #45ff00, #ff5500) border-box;
  opacity: .34;
  transform: translate(-42%, -50%);
}

.auth-card {
  position: relative;
  z-index: 1;
  border: 1px solid #ffffff;
  box-shadow: 0 34px 110px #00000078;
}

.alert {
  background: #ecffe5;
  color: #246f08;
  border-color: #b9f5a3;
}

@media (max-width: 600px) {
  .auth-body {
    background:
      radial-gradient(circle at 12% 10%, #7600ff45, transparent 42%),
      radial-gradient(circle at 90% 92%, #ff550029, transparent 34%),
      #0b0711;
  }

  .topbar-brand img {
    height: 31px;
    max-width: 130px;
  }
}

.lead-name,
.phone-link {
  color: #24172f;
  font-weight: 750;
  text-decoration: none;
}

.lead-name:hover,
.phone-link:hover {
  color: #7600ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lead-shell {
  max-width: 1120px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 24px;
  color: #6d5f78;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  color: #7600ff;
}

.lead-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.lead-hero h1 {
  margin: 4px 0 6px;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -.045em;
}

.lead-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-link,
.whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.whatsapp-button {
  padding: 11px 16px;
  border: 1px solid #b8f3a3;
  border-radius: 10px;
  background: #eaffe2;
  color: #1d6f00;
  font-weight: 800;
}

.whatsapp-button:hover {
  border-color: #45ff00;
  background: #ddffd1;
  transform: translateY(-1px);
}

.lead-layout {
  display: grid;
  grid-template-columns: minmax(300px, .82fr) minmax(380px, 1.18fr);
  gap: 18px;
  align-items: start;
}

.detail-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 34px #24133109;
}

.detail-card h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
  letter-spacing: -.025em;
}

.detail-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.lead-fields {
  display: grid;
  gap: 0;
  margin: 0;
}

.lead-fields div {
  padding: 13px 0;
  border-bottom: 1px solid #eee9f2;
}

.lead-fields dt {
  margin-bottom: 5px;
  color: #7b7083;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lead-fields dd {
  margin: 0;
  color: #21162b;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.lead-fields a {
  color: #6500dc;
  text-decoration: none;
}

.lead-fields a:hover {
  text-decoration: underline;
}

.stage-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 24px;
}

.stage-form label,
.notes-form label {
  display: grid;
  gap: 7px;
  color: #392d43;
  font-size: .83rem;
  font-weight: 800;
}

.notes-card {
  display: grid;
  gap: 22px;
}

.notes-display {
  min-height: 120px;
  padding: 18px;
  border-left: 4px solid #7600ff;
  border-radius: 0 11px 11px 0;
  background: #faf7fd;
  color: #2c2135;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.notes-display.is-empty {
  color: #85798e;
  font-style: italic;
}

.notes-form {
  display: grid;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid #eee9f2;
}

.notes-form textarea {
  min-height: 180px;
  line-height: 1.55;
}

.notes-form > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notes-help {
  color: #85798e;
  font-size: .76rem;
}

@media (max-width: 820px) {
  .lead-hero {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 520px) {
  .lead-actions,
  .lead-actions a {
    width: 100%;
  }

  .detail-card {
    padding: 21px 17px;
  }

  .stage-form {
    grid-template-columns: 1fr;
  }
}

.money-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.money-stat {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 6px;
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(29, 11, 55, .045);
}

.money-stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #7600ff;
}

.money-stat span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.money-stat strong {
  align-self: center;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  letter-spacing: -.035em;
}

.money-stat small { color: var(--muted); font-size: .77rem; }
.money-stat.won::before,
.money-stat.balance.positive::before { background: #28a745; }
.money-stat.won strong,
.money-stat.balance.positive strong { color: #16823c; }
.money-stat.lost::before,
.money-stat.balance.negative::before { background: #d83b36; }
.money-stat.lost strong,
.money-stat.balance.negative strong { color: #bc2e2a; }
.money-stat[href]:hover { transform: translateY(-2px); border-color: rgba(118, 0, 255, .3); }
.table-money,
.proposal-value { font-weight: 800; white-space: nowrap; }
.stage-form { grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr) auto; align-items: end; }
.save-stage-button {
  display: grid;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  font-size: 1.25rem;
  line-height: 1;
}

.filter-panel {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid #e7e0ec;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(29, 11, 55, .04);
}

.filter-panel.filters-below { margin-top: 18px; margin-bottom: 0; }

.filter-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.filter-heading h2 { margin: 3px 0 0; font-size: 1.2rem; }
.reset-filter { color: #7600ff; font-size: .84rem; font-weight: 800; text-decoration: none; }
.reset-filter:hover { text-decoration: underline; }

.filter-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(135px, 1fr));
  gap: 14px;
  align-items: end;
}

.filter-form label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #392d43;
  font-size: .8rem;
  font-weight: 800;
}

.filter-form .filter-wide { grid-column: span 2; }

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 2px;
}

.filter-result { display: grid; gap: 2px; }
.filter-result strong { color: #2c2135; font-size: .92rem; }
.filter-result span { color: var(--muted); font-size: .78rem; }

.topnav { display: flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 24px; }
.topbar-brand { color: inherit; text-decoration: none; }
.topnav a { padding: 8px 11px; border-radius: 8px; color: rgba(255,255,255,.72); font-size: .84rem; font-weight: 800; text-decoration: none; }
.topnav a:hover,
.topnav a.active { background: rgba(255,255,255,.11); color: #fff; }

.user-layout { display: grid; grid-template-columns: minmax(250px, .65fr) minmax(500px, 1.35fr); gap: 18px; align-items: start; }
.user-create-card,
.permission-summary,
.user-card { border: 1px solid #e7e0ec; border-radius: 15px; background: #fff; box-shadow: 0 10px 30px rgba(29,11,55,.04); }
.user-create-card { position: sticky; top: 20px; padding: 22px; }
.user-create-card h2 { margin: 4px 0 20px; font-size: 1.35rem; }
.user-form { display: grid; gap: 15px; }
.user-form label,
.user-controls label { display: grid; gap: 7px; color: #392d43; font-size: .8rem; font-weight: 800; }
.user-form label small { color: var(--muted); font-weight: 500; }
.users-list { display: grid; gap: 12px; }
.permission-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; background: #e7e0ec; }
.permission-summary div { display: grid; gap: 4px; padding: 15px; background: #fff; }
.permission-summary strong { color: #392d43; font-size: .82rem; }
.permission-summary span { color: var(--muted); font-size: .75rem; line-height: 1.45; }
.user-card { padding: 18px; }
.user-card.is-inactive { opacity: .66; }
.user-identity { display: flex; align-items: center; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid #eee9f2; }
.user-avatar { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; border-radius: 12px; background: #f1e7ff; color: #7600ff; font-weight: 900; }
.user-identity > div { display: grid; gap: 3px; min-width: 0; }
.user-identity > div strong { color: #2c2135; }
.user-identity > div span { overflow: hidden; color: var(--muted); font-size: .8rem; text-overflow: ellipsis; }
.access-status { margin-left: auto; padding: 5px 8px; border-radius: 999px; background: #fbe9e7; color: #a5362c; font-size: .72rem; font-weight: 800; }
.access-status.active { background: #e2f7eb; color: #167341; }
.user-controls { display: grid; grid-template-columns: 1fr 1.2fr auto auto; gap: 10px; align-items: end; padding-top: 15px; }
.user-controls label small { color: var(--muted); font-weight: 500; }
.active-toggle { display: flex !important; align-items: center; height: 43px; white-space: nowrap; }
.active-toggle input { width: 18px; height: 18px; }

@media (max-width: 950px) {
  .money-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-layout { grid-template-columns: 1fr; }
  .user-create-card { position: static; }
  .user-controls { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .money-stats { display: flex; overflow-x: auto; padding-bottom: 5px; }
  .money-stat { min-width: 245px; }
  .stage-form { grid-template-columns: 1fr; }
  .filter-form { grid-template-columns: 1fr; }
  .filter-form .filter-wide { grid-column: auto; }
  .filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-actions .primary:only-child { grid-column: 1 / -1; }
  .topnav { margin-right: 8px; }
  .topnav a { padding: 7px 8px; font-size: .78rem; }
  .permission-summary { grid-template-columns: 1fr; }
  .user-controls { grid-template-columns: 1fr; }
  .user-controls .secondary { width: 100%; }
}
