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

.summary-updated {
  align-self: center;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
}

.summary-updated time {
  display: block;
  color: var(--ink);
}

.summary-quick {
  display: grid;
  gap: 10px;
}

.summary-quick h3 {
  margin: 0;
}

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

.summary-quick-grid button,
.summary-attention-list button {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--white);
  text-align: left;
}

.summary-quick-grid button:hover,
.summary-attention-list button:hover {
  border-color: var(--teal-dark);
}

.summary-quick-grid span,
.summary-attention-list span,
.summary-attention-list small {
  color: var(--ink-soft);
  line-height: 1.4;
}

.summary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.summary-activity-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-activity-list li + li {
  border-top: 1px solid var(--line);
}

.summary-activity {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.summary-activity:hover {
  background: var(--blue-soft);
}

.summary-activity > span {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.summary-activity > span:last-child {
  justify-items: end;
  color: var(--ink-soft);
  font-size: 12px;
}

.summary-activity strong {
  overflow-wrap: anywhere;
}

.summary-activity time {
  white-space: nowrap;
}

.summary-attention-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.summary-attention-list strong {
  font-size: 18px;
}

.connection-card {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 8px 22px rgba(11, 36, 54, 0.06);
}

.connection-card > span:first-child {
  color: var(--ink);
  font-weight: 850;
}

.compact-state {
  min-height: 92px;
  margin-bottom: 18px;
}

.connection-error p,
.compact-state p,
.pipeline-empty {
  color: var(--ink-soft);
}

.connection-error .button {
  margin-top: 10px;
}

.knowledge-overview {
  margin-bottom: 14px;
}

.metric-date {
  font-size: 18px !important;
  line-height: 1.25;
}

.commercial-pipeline {
  grid-template-columns: repeat(4, minmax(230px, 1fr));
}

.pipeline-empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 13px;
  text-align: center;
}

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

.lead-card .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.ati-chat-panel {
  max-width: 820px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 12px 32px rgba(11, 36, 54, 0.08);
}

.whatsapp-continuation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #b8ded6;
  border-radius: 12px;
  background: #f2fbf8;
}

.whatsapp-continuation h3,
.whatsapp-continuation p {
  margin: 0;
}

.whatsapp-continuation p {
  margin-top: 5px;
  color: var(--muted, #587082);
}

.whatsapp-continuation.has-error {
  border-color: #e9c3c3;
  background: #fff7f7;
}

.button.whatsapp-button {
  flex: 0 0 auto;
  color: #fff;
  background: #187a62;
  border-color: #187a62;
}

.whatsapp-continuation-copy {
  flex: 1 1 auto;
}

.whatsapp-expiry,
.whatsapp-qr figcaption {
  font-size: 12px;
}

.whatsapp-continuation .whatsapp-button {
  display: inline-flex;
  margin-top: 12px;
}

.whatsapp-qr {
  flex: 0 0 auto;
  margin: 0;
  text-align: center;
}

.whatsapp-qr img {
  display: block;
  width: 164px;
  height: 164px;
  padding: 8px;
  border: 1px solid #b8ded6;
  border-radius: 10px;
  background: #fff;
}

.whatsapp-qr figcaption {
  margin-top: 6px;
  color: var(--muted, #587082);
}

.commercial-qr-panel {
  margin-top: 16px;
}

.commercial-qr-panel > h3,
.commercial-qr-panel > p {
  margin-top: 0;
}

.commercial-qr-active {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-color: #b8ded6;
  background: #f7fcfa;
}

.commercial-qr-copy {
  min-width: 0;
}

.commercial-connection-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}

.commercial-channel-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 16px 0;
}

.commercial-channel-details div {
  display: grid;
  gap: 3px;
}

.commercial-channel-details dt {
  color: var(--muted, #587082);
  font-size: 12px;
}

.commercial-channel-details dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.commercial-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.commercial-progress li {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted, #587082);
  background: var(--white);
  font-size: 12px;
}

.commercial-progress li.is-current {
  border-color: #b8ded6;
  background: #f2fbf8;
}

.commercial-progress strong {
  color: var(--ink);
}

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

.commercial-onboarding-options article,
.commercial-audit {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.commercial-onboarding-options h4,
.commercial-audit h4 {
  margin: 0 0 7px;
}

.commercial-onboarding-options small {
  display: block;
  margin-top: 8px;
  color: var(--muted, #587082);
}

.commercial-audit {
  margin-top: 12px;
}

.commercial-audit p {
  margin-bottom: 0;
  color: var(--muted, #587082);
}

@media (max-width: 680px) {
  .whatsapp-continuation {
    align-items: stretch;
    flex-direction: column;
  }

  .whatsapp-qr {
    align-self: center;
  }

  .commercial-qr-active {
    align-items: stretch;
    flex-direction: column;
  }

  .commercial-progress,
  .commercial-onboarding-options {
    grid-template-columns: 1fr;
  }
}

.ati-chat-log {
  min-height: 360px;
  max-height: 58vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 20px;
  background: linear-gradient(180deg, #fff 0%, #f6f9fb 100%);
}

.ati-message {
  width: fit-content;
  max-width: 82%;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--white);
  line-height: 1.48;
  white-space: pre-wrap;
}

.ati-message span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.ati-message.is-user {
  align-self: flex-end;
  color: var(--white);
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.ati-message.is-user span {
  color: rgba(255, 255, 255, 0.72);
}

.ati-chat-panel .form-result {
  margin: 0;
  padding: 10px 16px;
}

.ati-chat-panel .form-result.error {
  color: #8b2d24;
  background: #fff0ed;
}

.ati-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.ati-chat-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--white);
}

.ati-chat-form input:focus {
  border-color: var(--teal-dark);
  outline: 3px solid rgba(24, 183, 164, 0.18);
}

@media (max-width: 900px) {
  .connections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 620px) {
  .connections-grid {
    grid-template-columns: 1fr;
  }

  .summary-quick-grid {
    grid-template-columns: 1fr;
  }

  .summary-activity {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-activity > span:last-child {
    justify-items: start;
  }

  .ati-chat-log {
    min-height: 320px;
    padding: 14px;
  }

  .ati-message {
    max-width: 92%;
  }

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