:root {
  --green: #2f7d20;
  --green-dark: #155d18;
  --green-soft: #edf6eb;
  --charcoal: #20272f;
  --ink: #101820;
  --muted: #5f6b76;
  --line: #dfe6ec;
  --surface: #ffffff;
  --soft: #f5f7f8;
  --danger: #b42318;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(16, 24, 32, 0.1);
  --font: "Inter", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: var(--font);
}

img {
  display: block;
  max-width: 100%;
}

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

button,
input,
select {
  font: inherit;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(47, 125, 32, 0.12), rgba(32, 39, 47, 0.1)),
    var(--soft);
}

.login-shell {
  width: min(100%, 460px);
}

.login-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card img {
  width: 220px;
  margin-bottom: 24px;
}

.login-card h1,
.admin-header h1 {
  margin: 0;
  color: var(--charcoal);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1;
}

.login-card p:not(.eyebrow) {
  color: var(--muted);
}

.login-form,
.filter-form,
.status-form {
  display: grid;
  gap: 12px;
}

.login-form label,
.filter-form label {
  display: grid;
  gap: 6px;
  color: var(--charcoal);
  font-size: 0.88rem;
  font-weight: 850;
}

.login-form input,
.filter-form input,
.filter-form select,
.status-form select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.login-form input:focus,
.filter-form input:focus,
.filter-form select:focus,
.status-form select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 32, 0.14);
}

button,
.action-button,
.export-button,
.ghost-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--charcoal);
}

.export-button {
  background: var(--charcoal);
}

.danger-button {
  background: var(--danger);
}

.alert {
  border-radius: var(--radius);
  margin: 14px 0;
  padding: 12px;
  font-weight: 800;
}

.alert.error {
  background: #fee4e2;
  color: var(--danger);
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 16px clamp(16px, 4vw, 42px);
  backdrop-filter: blur(14px);
}

.admin-brand img {
  width: 210px;
}

.admin-main {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

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

.stats-grid div,
.toolbar,
.lead-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 24, 32, 0.05);
}

.stats-grid div {
  padding: 18px;
}

.stats-grid span {
  color: var(--muted);
  font-weight: 850;
}

.stats-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--charcoal);
  font-size: 2.2rem;
  line-height: 1;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-top: 18px;
  padding: 16px;
}

.filter-form {
  grid-template-columns: 190px minmax(220px, 1fr) auto auto;
  align-items: end;
}

.lead-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.empty-state {
  padding: 28px;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.lead-card {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.lead-topline,
.lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.lead-topline time {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-em_atendimento,
.status-proposta {
  background: #fff4d6;
  color: #8a5a00;
}

.status-ganho {
  background: #dcfce7;
  color: #166534;
}

.status-perdido,
.status-arquivado {
  background: #f1f5f9;
  color: #475569;
}

.lead-title h2 {
  margin: 0;
  color: var(--charcoal);
  font-size: 1.35rem;
}

.lead-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-weight: 700;
}

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

.lead-details div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 12px;
}

.lead-details dt,
.message-box span {
  color: var(--green-dark);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lead-details dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.message-box {
  border-left: 4px solid var(--green);
  background: var(--green-soft);
  padding: 14px;
}

.message-box p {
  margin: 6px 0 0;
  color: var(--charcoal);
}

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

.status-form {
  grid-template-columns: minmax(180px, 220px) auto;
}

@media (max-width: 900px) {
  .admin-header {
    grid-template-columns: 1fr;
  }

  .admin-brand img {
    width: 190px;
  }

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

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

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

@media (max-width: 620px) {
  .login-card {
    padding: 20px;
  }

  .stats-grid,
  .lead-details,
  .status-form {
    grid-template-columns: 1fr;
  }

  .lead-actions > *,
  .lead-actions form,
  .lead-actions button,
  .lead-actions a {
    width: 100%;
  }
}
