@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700&family=Montserrat:wght@500;600;700;800&family=Nunito+Sans:wght@400;600;700;800&display=swap");

:root {
  --bg: #0c0f12;
  --surface: #161a1e;
  --surface-2: #1d2227;
  --line: #343b43;
  --muted: #b8c1ca;
  --text: #f6f3ee;
  --orange: #f28a2e;
  --orange-soft: rgba(242, 138, 46, 0.12);
  --red: #ef4b43;
  --green: #76aa68;
  --blue: #11a9bd;
  --gray: #7b858e;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito Sans", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 32px;
}

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

.brand-mark {
  width: 88px;
  height: 72px;
  background: #030303;
  color: #f5f1eb;
  display: grid;
  place-items: center;
  font-weight: 950;
  font-size: 22px;
  border-radius: 8px;
  border: 1px solid #1f252b;
}

.brand-mark.small {
  width: 64px;
  height: 56px;
  font-size: 17px;
  flex: 0 0 auto;
}

.eyebrow {
  display: block;
  color: #9fc9d8;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 850;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
.nav-item,
.primary-button,
.secondary-button,
.danger-button,
.ghost-icon,
.metric-card span,
.lead-name,
label span,
.tag {
  font-family: "Montserrat", "Nunito Sans", "Segoe UI", Arial, sans-serif;
}

h1,
h2 {
  margin-bottom: 8px;
  line-height: 0.98;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(48px, 7vw, 82px);
}

h2 {
  font-size: clamp(44px, 5vw, 76px);
}

h3 {
  margin-bottom: 6px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

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

label {
  display: grid;
  gap: 8px;
}

label span {
  color: #c1cad2;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  background: #111519;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.16);
}

textarea {
  resize: vertical;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-icon,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  background: #14191e;
}

.primary-button {
  background: #d88445;
  border-color: #d88445;
  color: #fff;
}

.whatsapp-button {
  background: #25d366;
  border-color: #25d366;
  color: #082b17;
}

.claude-button {
  background: #c15f3c;
  border-color: #c15f3c;
  color: #fff8f3;
}

.secondary-button:hover,
.ghost-icon:hover,
.icon-button:hover {
  border-color: var(--orange);
}

.danger-button {
  background: rgba(239, 75, 67, 0.14);
  border-color: rgba(239, 75, 67, 0.6);
  color: #ffd2cf;
}

.full {
  width: 100%;
}

.error-text {
  margin: 0;
  color: #ffb2ad;
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #0d1013;
}

.sidebar-brand span,
.operator-card span {
  display: block;
  color: var(--muted);
}

.operator-card {
  margin: 24px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.operator-card span {
  color: var(--orange);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.nav-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.nav-item.active {
  background: rgba(242, 138, 46, 0.14);
  border-color: rgba(242, 138, 46, 0.38);
  color: #ffd7b5;
}

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

.topbar,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
  border-radius: 8px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metric-card {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 18px;
  border-radius: 8px;
  border-left: 6px solid var(--orange);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(310px, 360px);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  min-height: 560px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.column-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.column-dot {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: var(--orange);
}

.column-dot.color-red {
  background: var(--red);
}

.column-dot.color-green {
  background: var(--green);
}

.column-dot.color-blue {
  background: var(--blue);
}

.column-dot.color-gray {
  background: var(--gray);
}

.column-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-count {
  color: var(--muted);
  font-weight: 850;
}

.column-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.mini-button {
  border: 1px solid var(--line);
  background: #101418;
  color: var(--text);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.calendar-button {
  border-color: rgba(74, 159, 255, 0.42);
  color: #d7eaff;
}

.cards-zone {
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.cards-zone.drag-over {
  outline: 2px dashed rgba(255, 122, 26, 0.7);
  outline-offset: -8px;
  background: rgba(255, 122, 26, 0.05);
}

.lead-card {
  border: 1px solid var(--line);
  background: #101418;
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.lead-card[draggable="true"] {
  cursor: grab;
}

.lead-card.dragging {
  opacity: 0.55;
}

.lead-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.lead-name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.lead-inline-tags {
  display: grid;
  justify-items: start;
  gap: 5px;
  margin-top: 8px;
}

.lead-phone,
.lead-meta,
.lead-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.lead-offer {
  border: 1px solid rgba(184, 193, 202, 0.18);
  background: rgba(255, 255, 255, 0.035);
  color: #e8edf1;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--orange);
}

.project-tag {
  background: rgba(159, 201, 216, 0.14);
  border: 1px solid rgba(159, 201, 216, 0.42);
  color: #dceef5;
}

.lead-value {
  color: #f2c94c;
  font-family: "Montserrat", "Nunito Sans", "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  align-self: center;
}

.tag.priority-alta,
.tag.color-red {
  background: var(--red);
}

.tag.priority-baixa,
.tag.color-green {
  background: var(--green);
}

.tag.color-blue {
  background: var(--blue);
}

.tag.color-gray {
  background: var(--gray);
}

.lead-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
  align-items: center;
}

.lead-actions .primary-button:first-child {
  grid-column: auto;
}

.lead-actions .primary-button,
.lead-actions .secondary-button {
  min-height: 34px;
  padding: 8px 11px;
  font-size: 12px;
}

.lead-actions .whatsapp-button {
  min-width: 96px;
}

.view-panel {
  min-width: 0;
}

.table-wrap,
.settings-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.settings-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 16px;
}

.settings-card {
  padding: 18px;
}

.channel-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.status-text {
  margin: 12px 0 0;
  color: #ffb2ad;
  font-weight: 800;
}

.status-text.ok {
  color: #a7d89a;
}

.channel-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.modal {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.modal-card {
  width: min(980px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-card.narrow {
  width: min(520px, calc(100vw - 28px));
}

.modal-card.conversation-modal {
  width: min(1180px, calc(100vw - 28px));
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  flex: 0 0 auto;
}

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

.conversation-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
}

.conversation-info,
.conversation-panel {
  border: 1px solid var(--line);
  background: #101418;
  border-radius: 8px;
}

.conversation-info {
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.conversation-info strong {
  font-size: 22px;
}

.conversation-info p {
  margin-bottom: 0;
}

.conversation-panel {
  min-height: 560px;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.messages-list {
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  max-height: 58vh;
}

.empty-messages {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
}

.message-bubble {
  width: min(78%, 620px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
}

.message-bubble.sent {
  margin-left: auto;
  border-color: rgba(255, 122, 26, 0.55);
  background: rgba(255, 122, 26, 0.13);
}

.message-bubble.received {
  margin-right: auto;
  border-color: rgba(17, 169, 189, 0.5);
}

.message-bubble.internal {
  width: 100%;
  border-color: rgba(118, 170, 104, 0.45);
  background: rgba(118, 170, 104, 0.1);
}

.message-bubble p {
  margin: 8px 0 0;
  color: var(--text);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.message-meta strong {
  color: var(--text);
}

.message-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.message-text-field textarea {
  min-height: 54px;
}

.span-2 {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.modal-actions.right-only {
  justify-content: flex-end;
}

.modal-actions-right {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

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

  .side-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar,
  .panel-head {
    display: grid;
  }

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

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

@media (max-width: 620px) {
  .workspace,
  .sidebar,
  .login-card,
  .modal-card {
    padding: 16px;
  }

  .brand-block,
  .sidebar-brand {
    align-items: flex-start;
  }

  .metrics-row,
  .form-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    grid-auto-columns: minmax(286px, 86vw);
  }

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

  .top-actions,
  .modal-actions,
  .modal-actions-right {
    display: grid;
    width: 100%;
  }

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

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

  .conversation-panel {
    min-height: 520px;
  }

  .messages-list {
    max-height: 46vh;
  }

  .message-bubble {
    width: 100%;
  }

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