* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.22), transparent 34%),
    radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.2), transparent 36%),
    #020617;
  color: #e5e7eb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.chat-card {
  width: min(1040px, 100%);
  height: min(780px, calc(100vh - 48px));
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 30px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.topbar {
  padding: 26px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

h1 {
  margin: 0;
  font-size: 32px;
}

p {
  margin: 6px 0 0;
  color: #94a3b8;
}

.status {
  padding: 8px 13px;
  border-radius: 999px;
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.26);
  font-weight: 700;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  max-width: 78%;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bot {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
}

.pending {
  opacity: 0.72;
}

.error {
  background: rgba(127, 29, 29, 0.75);
  border-color: rgba(248, 113, 113, 0.3);
}

.composer {
  padding: 18px;
  display: flex;
  gap: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

input {
  flex: 1;
  color: white;
  background: rgba(2, 6, 23, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  padding: 15px 16px;
  font-size: 16px;
  outline: none;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 0 24px;
  background: #38bdf8;
  color: #082f49;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.small-btn {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(15, 23, 42, 0.72);
  color: #e5e7eb;
  font-weight: 800;
  cursor: pointer;
}

.small-btn:hover {
  background: rgba(30, 41, 59, 0.96);
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(420px, 100%);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.modal-card h2 {
  margin: 0;
  font-size: 26px;
}

.login-form {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  width: 100%;
}

.login-form button {
  min-height: 48px;
}

.login-error {
  min-height: 22px;
  margin-top: 12px;
  color: #fca5a5;
  font-weight: 700;
}

.plain-btn {
  margin-top: 8px;
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.72);
  color: #e5e7eb;
  font-weight: 800;
  cursor: pointer;
}

.plain-btn:hover {
  background: rgba(51, 65, 85, 0.9);
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .msg {
    max-width: 92%;
  }

  .composer {
    flex-direction: column;
  }

  .composer button {
    min-height: 48px;
  }
}

.admin-card {
  height: min(820px, calc(100vh - 48px));
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
}

.admin-panel {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  padding: 20px;
}

.admin-panel h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.small-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: #082f49;
  background: #38bdf8;
  font-weight: 900;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e5e7eb;
  font-weight: 700;
}

.check-row input {
  flex: 0;
  width: auto;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.user-row strong {
  display: block;
  color: #f8fafc;
  font-size: 16px;
}

.user-row span {
  color: #94a3b8;
  font-size: 13px;
}

.user-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-tags span {
  padding: 6px 9px;
  border-radius: 999px;
  color: #bfdbfe;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.18);
  font-weight: 800;
}

@media (max-width: 860px) {
  .admin-content {
    grid-template-columns: 1fr;
  }
}
