.person-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: #e8efdf;
  color: var(--brand);
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
}
.person-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.person-avatar.large {
  width: 84px;
  height: 84px;
  flex-basis: 84px;
  font-size: 26px;
  border: 4px solid var(--surface);
  box-shadow: 0 4px 14px #183b2412;
}
.person-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px;
  margin: -5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  min-width: 190px;
}
.person-link:hover {
  background: var(--surface-soft);
}
.person-link > span:nth-child(2) {
  min-width: 0;
}
.person-link strong,
.person-link .small {
  display: block;
}
.profile-chevron {
  margin-left: auto;
  color: var(--muted);
}
#profile-dialog {
  padding: 0;
  width: min(580px, calc(100vw - 28px));
  max-width: 580px;
  max-height: calc(100dvh - 40px);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: auto;
}
#profile-dialog::backdrop {
  background: #12281e70;
  backdrop-filter: blur(4px);
}
.profile-cover {
  padding: 24px 28px 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(115deg, #e6eddb, #f2f6e9);
}
.profile-close {
  border-radius: 50%;
  background: #ffffffb0;
}
.profile-body {
  padding: 0 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.profile-identity {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: -28px;
}
.profile-identity > div {
  padding-top: 28px;
  min-width: 0;
}
.profile-identity h2 {
  font-size: 24px;
  overflow-wrap: anywhere;
}
.profile-actions,
.profile-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.profile-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 0;
}
.profile-details dt {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.profile-details dd {
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.profile-section {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.profile-section h3 {
  margin-bottom: 12px;
}
.profile-section h3 span {
  float: right;
  font-weight: 400;
}
.profile-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.profile-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.profile-totals strong {
  display: block;
  font-size: 22px;
  font-weight: 650;
}
.profile-totals span {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.profile-footer {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.profile-loading {
  padding: 32px;
  display: grid;
  gap: 20px;
}
.skeleton-line {
  height: 16px;
  border-radius: 8px;
  background: var(--surface-soft);
  animation: soft-pulse 1.2s ease-in-out infinite alternate;
}
.skeleton-line.short {
  width: 60%;
}
@keyframes soft-pulse {
  to {
    opacity: 0.4;
  }
}
#page-analytics {
  margin-bottom: 24px;
}
.page-insights {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
}
.insight-topline {
  padding: 12px 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.insight-topline .btn {
  margin-left: auto;
}
.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 16px 0 22px;
}
.insight-metric {
  padding: 0 22px;
  border-right: 1px solid var(--line);
}
.insight-metric:last-child {
  border: 0;
}
.insight-metric > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.insight-metric strong {
  display: block;
  font-size: 28px;
  line-height: 1.4;
  letter-spacing: -0.8px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.insight-metric small {
  font-size: 10px;
  color: var(--muted);
  display: block;
}
.insight-details {
  border-top: 1px solid var(--line);
  background: #fbfcf9;
}
.insight-details summary {
  cursor: pointer;
  padding: 12px 20px;
  font-size: 12px;
}
.insight-details summary > span:last-child {
  float: right;
}
.insight-expanded {
  padding: 4px 22px 22px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
}
.trend-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  height: 135px;
  margin-bottom: 12px;
}
.trend-day {
  text-align: center;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trend-day strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.trend-day span {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}
.trend-day svg {
  width: 100%;
  height: 75px;
}
.insight-breakdown h3 {
  margin-bottom: 8px;
}
.insight-breakdown .row {
  padding: 3px 0;
  font-size: 12px;
}
.analytics-loading {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
}
/* More of the viewport belongs to the conversation, with a quiet message canvas. */
.conversations {
  grid-template-columns: 300px minmax(0, 1fr);
  height: max(680px, calc(100dvh - 190px));
  min-height: 600px;
  border-radius: 18px;
}
.conversation-list {
  background: var(--surface);
}
.conversation-search {
  padding: 16px;
}
.conversation-item {
  padding: 14px;
  border-bottom-color: transparent;
  margin: 3px 7px;
  width: calc(100% - 14px);
  border-radius: 12px;
  transition: background 0.15s ease;
}
.conversation-item.selected {
  box-shadow: none;
  background: #edf3e5;
}
.conversation-info strong {
  font-size: 13px;
}
.conversation-item .chat-time {
  font-size: 10px;
}
.conversation-item .chat-preview {
  line-height: 1.45;
  margin: 5px 0;
}
.conversation-header {
  padding: 14px 20px;
  background: var(--surface);
}
.conversation-header .person-link {
  flex: 1;
  min-width: 0;
}
.conversation-header .person-link h2 {
  font-size: 16px;
}
.conversation-header .person-link .small {
  text-align: left;
}
.conversation-options {
  padding: 8px 20px;
  background: #fcfdfb;
}
.message-history {
  position: relative;
  background: #f4f6f0;
  padding: 20px 28px;
  scrollbar-gutter: stable;
  overflow-anchor: none;
}
#message-bubbles {
  gap: 5px;
}
.message {
  max-width: 80%;
  border-color: #e3e8df;
  border-radius: 15px 15px 15px 5px;
  padding: 12px 15px 8px;
  box-shadow: 0 2px 4px #183b2404;
  margin-top: 11px;
}
.message.outgoing {
  background: #e5eedb;
  border-color: #dce6d2;
  border-radius: 15px 15px 5px 15px;
}
.message.automated {
  background: #edf0e8;
}
.message.grouped {
  margin-top: 0;
}
.message.grouped .message-author {
  display: none;
}
.message-text {
  font-size: 13px;
  line-height: 1.7;
  unicode-bidi: plaintext;
}
.message-text a {
  text-underline-offset: 3px;
}
.message-meta {
  font-size: 10px;
  margin-top: 7px;
  gap: 9px;
}
.message-author {
  font-size: 11px;
  margin-bottom: 5px;
}
.message-delivery {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--brand);
}
.message-delivery.problem {
  color: var(--danger);
}
.message-reply {
  font-size: 11px;
  border-radius: 5px;
  padding: 2px 5px;
}
.message-reply:hover {
  background: #ffffffaa;
}
.message-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 5px;
}
.message-buttons a,
.message-buttons .chip {
  text-align: center;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
}
.message-quote {
  border-left: 3px solid #7d9f68;
  background: #ffffff70;
  padding: 7px 10px;
  margin: 0 0 9px;
  border-radius: 5px;
  font-size: 12px;
}
.message-quote strong {
  display: block;
  font-size: 11px;
  color: var(--brand);
}
.message-quote p {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.message-day {
  align-self: center;
  border: 1px solid #e2e8dd;
  background: #fbfcf8;
  color: var(--muted);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 10px;
  margin: 17px 0 9px;
}
.reply-composer {
  padding: 14px 20px;
  gap: 8px;
  background: var(--surface);
}
.reply-composer textarea {
  border-radius: 12px;
  background: #fbfcf9;
  min-height: 64px;
}
.reply-composer > label {
  font-size: 11px;
  color: var(--muted);
}
.jump-latest {
  align-self: center;
  margin: 8px;
  font-size: 12px;
}
.conversation-skeleton {
  padding: 28px;
  display: grid;
  gap: 20px;
  width: 100%;
}
.conversation-skeleton .skeleton-line {
  height: 52px;
  width: 65%;
}
.conversation-skeleton .skeleton-line:nth-child(2n) {
  margin-left: auto;
}
@media (max-width: 1100px) {
  .conversations {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .conversation-item .chat-time {
    display: none;
  }
  .message {
    max-width: 94%;
  }
}
@media (max-width: 760px) {
  .insight-grid {
    grid-template-columns: 1fr 1fr;
    row-gap: 20px;
  }
  .insight-metric:nth-child(2) {
    border: 0;
  }
  .insight-topline > .small {
    display: none;
  }
  .insight-details summary > span:last-child {
    display: none;
  }
  .insight-expanded {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .conversations {
    display: block;
    height: calc(100dvh - 105px);
    min-height: 590px;
  }
  .message-history {
    padding: 12px;
  }
  .conversation-header,
  .reply-composer {
    padding: 12px;
  }
  .profile-body {
    padding-left: 20px;
    padding-right: 20px;
  }
  .profile-totals {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
  }
  .conversation-item {
    transition: none;
  }
}
