:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #121212;
  --muted: #667085;
  --line: #e5e7eb;
  --accent: #111827;
  --success: #137333;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 70%);
  color: var(--text);
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(224, 231, 255, 0.4));
  top: -200px;
  right: -180px;
  filter: blur(10px);
  z-index: -1;
}

.container {
  width: min(1200px, 92vw);
  margin: 30px auto;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
}

.header p {
  margin-top: 6px;
  color: var(--muted);
}

.grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

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

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.row {
  display: flex;
  gap: 10px;
}

.row-training {
  margin-top: 2px;
}

input,
textarea,
button {
  font-family: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.95rem;
  background: #fff;
}

textarea {
  min-height: 140px;
  resize: vertical;
  margin-bottom: 10px;
}

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

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

.btn-danger {
  background: #b42318;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.card-chat {
  grid-row: span 2;
}

.chat-log {
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 320px;
  overflow-y: auto;
  padding: 10px;
  margin-bottom: 10px;
  background: #fff;
}

.msg {
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 8px;
  max-width: 88%;
  line-height: 1.4;
}

.msg.user {
  margin-left: auto;
  background: #eef2ff;
}

.msg.bot {
  background: #f3f4f6;
}

.wa-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.qr-wrap {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  min-height: 240px;
  display: grid;
  place-items: center;
  background: #fff;
}

#wa-qr {
  width: min(240px, 90%);
  height: auto;
  display: none;
}

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

  .card-chat {
    grid-row: auto;
  }
}
