:root {
  --bg: #0f172a;
  --bg-2: #0b1120;
  --ink: #0f172a;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --card: #0f172a;
  --line: #1f2a44;
  --panel: #e2e8f0;
  --success: #22c55e;
  --danger: #f43f5e;
  --shadow: 0 18px 40px rgba(2, 6, 23, 0.25);
  --radius: 18px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

* { box-sizing: border-box; }

body.page {
  margin: 0;
  color: #f8fafc;
  background:
    radial-gradient(circle at 15% 20%, #0f172a 0%, #0b1120 55%),
    linear-gradient(140deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.08));
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; margin: 0; color: #f8fafc; }

.landing {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  padding: 48px 8vw 72px;
}

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

.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: 'Playfair Display', serif;
}

.kicker { margin: 0; text-transform: uppercase; font-size: 12px; letter-spacing: 0.2em; color: #cbd5f5; }

.hero { display: grid; gap: 24px; }

.lead { font-size: 18px; line-height: 1.6; max-width: 560px; color: #e2e8f0; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.feature {
  background: #111827;
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.info-card {
  background: #111827;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.info-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #cbd5f5;
}

.auth { display: grid; align-items: start; }

.auth-card {
  background: #0b1324;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.floating { animation: floatIn 0.8s ease; }

@keyframes floatIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.tab {
  border: 1px solid var(--line);
  background: transparent;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  color: #e2e8f0;
}

.tab.active { background: var(--accent); color: #fff; border-color: transparent; }

.auth-form { display: grid; gap: 12px; }

label { display: grid; gap: 6px; font-size: 14px; color: #cbd5f5; }

input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #1f2a44;
  font-size: 15px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #0f172a;
  color: #f8fafc;
}

input::placeholder { color: #64748b; }

.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

.primary:hover { background: #4f46e5; }

.ghost {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid #1f2a44;
  text-decoration: none;
  color: #e2e8f0;
  background: transparent;
}

.ghost:hover { border-color: var(--accent-2); color: #f8fafc; }

.form-msg { font-size: 13px; min-height: 18px; margin: 0; color: #94a3b8; }

.hint { font-size: 12px; color: #94a3b8; margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.hidden { display: none; }

.change-page {
  padding: 48px 6vw;
  display: grid;
  justify-content: center;
}

.chat-page { padding: 28px 6vw 40px; }

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chat-header h2 { color: #f1f5f9; }

.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.chat-layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow);
  padding: 16px;
  min-height: 520px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  color: #0f172a;
}

.users-panel, .profile-panel { grid-template-rows: auto 1fr; }

.panel-title { font-weight: 600; margin-bottom: 12px; }

.users-list { display: grid; gap: 10px; }

.user-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  background: #fff;
  align-items: center;
}

.user-card.active { border-color: var(--accent-2); background: rgba(139, 92, 246, 0.12); }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #e2e8f0;
  font-weight: 700;
  font-size: 14px;
}

.user-info { display: grid; gap: 4px; }

.user-name {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
  text-wrap: balance;
}

.user-meta { font-size: 12px; color: #64748b; }

.messages {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow-y: auto;
  padding-right: 6px;
}

.message {
  max-width: 70%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.message.in { background: #ffffff; border-top-left-radius: 4px; justify-self: start; }
.message.out { background: rgba(34, 197, 94, 0.18); border-top-right-radius: 4px; justify-self: end; }

.message small { display: block; color: #64748b; margin-top: 4px; font-size: 11px; }

.message-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 12px; }

.profile-card { display: grid; gap: 18px; font-size: 14px; }

.profile-header { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #111827;
  color: #e2e8f0;
  font-weight: 700;
  font-size: 16px;
}

.profile-meta { display: grid; gap: 6px; }

.profile-name { font-weight: 600; font-size: 16px; color: #0f172a; }

.profile-line { font-size: 13px; color: #64748b; word-break: break-word; }

.profile-status { font-size: 12px; color: #94a3b8; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--danger);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 60;
}

.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 960px) {
  .landing { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .panel { min-height: auto; }
}
