:root {
  --primary-dark: #1f2937;
  --primary-dark-hover: #111827;
  --accent: #f97316;
  --accent-soft: #fff1e8;
  --accent-border: #fed7aa;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --border: #e5e7eb;
  --card-bg: rgba(255, 255, 255, 0.96);
  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 18px 40px rgba(0, 0, 0, 0.08);
  --page-bg: linear-gradient(180deg, #fff7ed 0%, #f8fafc 45%, #eef4ff 100%);
}

.chat-page {
  min-height: calc(100vh - 160px);
  padding: 44px 0 64px;
  background: var(--page-bg);
}

.chat-shell {
  max-width: 960px;
  margin: 0 auto;
}

.page-title {
  margin-bottom: 22px;
}

.page-kicker {
  display: inline-block;
  margin: 0 0 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
}

.page-title h1 {
  margin: 0 0 10px;
  color: var(--text-main);
  font-size: 2.35rem;
  line-height: 1.05;
  letter-spacing: -0.8px;
}

.page-title h1 span {
  color: var(--accent);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.chat-card {
  background: var(--card-bg);
  border: 1px solid rgba(229, 231, 235, 0.95);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
}

.chat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.chat-card-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background:
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.05), transparent 25%),
    radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.04), transparent 30%),
    #fcfcfd;
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  transition: 0.22s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.chat-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 999px;
  background: transparent;
  transition: 0.22s ease;
}

.chat-item:hover {
  transform: translateY(-2px);
  border-color: #d1d5db;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.07);
}

.chat-item:hover::before {
  background: var(--accent);
}

.chat-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.chat-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.chat-avatar-fallback {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(249, 115, 22, 0.22);
}

.chat-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  border: 2px solid #fff7ed;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  background: #f3f4f6;
}

.chat-avatar-fallback {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(249, 115, 22, 0.22);
}

.chat-name {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-last {
  font-family: 'DM Mono', monospace;
  font-size: 0.73rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-meta {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-soft);
  flex-shrink: 0;
  text-align: right;
}

.chat-delete-btn {
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s ease;
  display: grid;
  place-items: center;
}

.chat-delete-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.chat-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 6px;
  margin-left: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 320px;
  padding: 32px 20px;
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-text {
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 420px;
}

@media (max-width: 700px) {
  .chat-page {
    padding: 30px 0 42px;
  }

  .page-title h1 {
    font-size: 1.95rem;
  }

  .chat-card {
    border-radius: 20px;
  }

  .chat-card-top {
    padding: 16px 16px;
  }

  .chat-list {
    padding: 14px;
  }

  .chat-item {
    padding: 14px 14px;
    border-radius: 16px;
  }

  .chat-name {
    font-size: 0.92rem;
  }

  .chat-last,
  .chat-meta {
    font-size: 0.66rem;
  }

  .empty-state {
    min-height: 240px;
  }
}