.chat-layout {
  display: flex;
  height: 72vh;
}

.chat-list {
  width: 270px;
  flex-shrink: 0;
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  background: var(--color-surface-alt);
}

.chat-list .chat-list-item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
  transition: background var(--transition-fast);
}

.chat-list .chat-list-item:hover {
  background: var(--color-surface);
}

.chat-list .chat-list-item.active {
  background: var(--color-surface);
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.chat-list .chat-list-item.unread .chat-username::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  margin-right: var(--space-2);
  vertical-align: middle;
}

.chat-list .chat-list-item.accepted {
  box-shadow: inset 3px 0 0 var(--color-success);
}

.chat-list .chat-username {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-strong);
}

.chat-list .chat-last-msg {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  min-width: 0;
}

.chat-main-header {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: 0.85rem;
}

.chat-main-header #chat-offer-amount {
  font-weight: 700;
  color: var(--color-text-strong);
  margin-left: var(--space-2);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-bubble {
  max-width: 70%;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  align-self: flex-start;
  font-size: 0.87rem;
  border: 1px solid var(--color-border);
}

.chat-bubble.from-owner {
  background: var(--color-info-soft);
  border-color: transparent;
  align-self: flex-start;
}

.chat-bubble.from-offerer {
  background: var(--color-primary);
  color: var(--color-primary-text-on);
  border-color: transparent;
  align-self: flex-end;
}

.chat-bubble.from-admin {
  background: var(--color-warning-soft);
  border-color: transparent;
  align-self: center;
  max-width: 60%;
  font-size: 0.82rem;
}

.chat-bubble .chat-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.68rem;
  opacity: 0.7;
  margin-top: 4px;
}

.chat-bubble .hide-toggle-btn {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.65;
  font-size: 0.72rem;
  text-decoration: underline;
}

.chat-input-row {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.chat-input-row input[type='text'] {
  flex: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  padding: 0 var(--space-4);
  height: var(--input-height);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input-row input[type='text']:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
  background: var(--color-surface);
}

@media (max-width: 768px) {
  .chat-layout {
    flex-direction: column;
    height: 78vh;
  }

  .chat-list {
    width: 100%;
    max-height: 170px;
    border-left: none;
    border-bottom: 1px solid var(--color-border);
  }
}
