:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #eef3fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(45, 212, 191, 0.12), transparent 26%),
    linear-gradient(180deg, #f4f8ff 0%, #eef3fb 100%);
}

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

button {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  min-height: 42px;
  padding: 0.7rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: #172033;
  border: 1px solid #d3dded;
}

button.ghost {
  background: transparent;
  color: #127a43;
  border: 1px solid rgba(18, 122, 67, 0.18);
}

button.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

input,
select,
textarea {
  width: 100%;
  margin-top: 0.4rem;
  border: 1px solid #d4ddec;
  border-radius: 8px;
  padding: 0.72rem 0.82rem;
  background: #fff;
  color: #172033;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

.auth-shell,
.shell {
  min-height: 100vh;
}

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-panel,
.panel,
.hero,
.detail-card,
.config-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(210, 221, 239, 0.9);
  border-radius: 16px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.08);
}

.auth-panel {
  width: min(460px, 100%);
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.label {
  margin: 0 0 0.42rem;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #22a55a;
}

.muted,
.empty,
.status {
  color: #52607a;
}

.shell {
  width: min(1600px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 1.75rem;
}

.section-gap {
  margin-top: 1rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  background: rgba(10, 18, 33, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  flex-direction: column;
  color: #fff;
}

.brand strong {
  font-size: 1.15rem;
}

.chips,
.actions,
.filters,
.form-grid,
.inline-form,
.mini-stats,
.stage-actions,
.quick-replies {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #d7deeb;
  background: transparent;
  box-shadow: none;
}

.chip.active {
  background: #fff;
  color: #111827;
}

.pipeline-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pipeline-tab {
  min-height: 38px;
  padding: 0.5rem 0.85rem;
  border: 1px solid #d3dded;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  box-shadow: none;
  font-weight: 700;
}

.pipeline-tab.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.hero {
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.7fr);
  gap: 1rem;
  align-items: end;
}

.hero h1,
.panel h2,
.detail-card h3,
.config-card h3 {
  margin: 0;
  color: #0f172a;
}

.hero h1 {
  font-size: clamp(1.9rem, 3vw, 2.55rem);
  line-height: 1.05;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric {
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d8e2f0;
}

.metric span {
  display: block;
  color: #5a6a84;
  margin-bottom: 0.35rem;
}

.metric strong {
  font-size: 1.45rem;
}

.main-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(360px, 0.9fr);
  gap: 1rem;
}

.panel,
.detail-card,
.config-card {
  padding: 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header-wrap {
  align-items: flex-start;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(250px, 1fr));
  gap: 0.9rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.column {
  min-height: 520px;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(243, 247, 253, 0.95);
  border: 1px solid #d8e2f0;
}

.column-success {
  background: rgba(220, 252, 231, 0.75);
}

.column-danger {
  background: rgba(254, 226, 226, 0.7);
}

.column-warning {
  background: rgba(254, 249, 195, 0.6);
}

.column-info {
  background: rgba(219, 234, 254, 0.6);
}

.column h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.count-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.count-badge {
  background: rgba(34, 197, 94, 0.12);
  color: #136b3d;
  margin-left: 0.5rem;
}

.status-pill {
  background: rgba(34, 197, 94, 0.12);
  color: #136b3d;
}

.lead-card {
  width: 100%;
  text-align: left;
  padding: 0.9rem;
  border-radius: 10px;
  border: 1px solid #d8e2f0;
  background: #fff;
  color: #172033;
  box-shadow: none;
  margin-bottom: 0.75rem;
}

.lead-card.active {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.12);
}

.lead-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.lead-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.lead-card small {
  display: block;
  color: #52607a;
  line-height: 1.45;
}

.detail-stack,
.config-stack {
  display: grid;
  gap: 1rem;
}

.detail-card,
.config-card {
  display: grid;
  gap: 0.9rem;
}

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

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

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.95rem;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.mini-stats {
  align-items: center;
}

.info-chip,
.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.info-chip {
  background: rgba(18, 122, 67, 0.08);
  color: #136b3d;
  border: 1px solid rgba(18, 122, 67, 0.15);
}

.priority-baixa {
  background: #eef2ff;
  color: #3846a8;
}

.priority-normal {
  background: rgba(34, 197, 94, 0.12);
  color: #136b3d;
}

.priority-alta {
  background: rgba(251, 191, 36, 0.18);
  color: #92400e;
}

.priority-urgente {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
}

.lead-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.info-box {
  border: 1px solid #d8e2f0;
  border-radius: 10px;
  background: #fff;
  padding: 0.85rem 0.95rem;
}

.info-box span {
  display: block;
  font-size: 0.82rem;
  color: #5a6a84;
  margin-bottom: 0.3rem;
}

.info-box strong {
  display: block;
  color: #0f172a;
}

.quick-reply {
  background: #fff;
  color: #0f172a;
  border: 1px solid #d8e2f0;
  box-shadow: none;
  min-height: 36px;
  padding: 0.5rem 0.8rem;
}

.secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
}

.secret-row input {
  margin-top: 0;
}

.secret-toggle {
  min-height: 40px;
  min-width: 96px;
  padding: 0.45rem 0.75rem;
}

.secret-clear {
  background: #fff;
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, 0.35);
  box-shadow: none;
}

.secret-clear:hover {
  background: rgba(254, 226, 226, 0.5);
}

.message-list,
.record-list {
  display: grid;
  gap: 0.75rem;
  max-height: 320px;
  overflow: auto;
}

.bubble,
.record {
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid #d8e2f0;
  background: #fff;
}

.bubble.out {
  background: rgba(34, 197, 94, 0.08);
}

.bubble header,
.record header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  color: #52607a;
  font-size: 0.85rem;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.status {
  min-height: 1.25rem;
}

.danger-text {
  color: #b91c1c;
}

@media (max-width: 1100px) {
  .hero,
  .main-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 760px) {
  .shell {
    width: min(100%, calc(100% - 1rem));
    padding: 0.75rem 0 1.25rem;
  }

  .topbar {
    padding: 1rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics,
  .form-grid,
  .form-grid-3,
  .lead-meta-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .secret-row {
    grid-template-columns: 1fr;
  }

  .kanban {
    grid-template-columns: repeat(8, minmax(220px, 1fr));
  }
}
