* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --skyfi: #6B4EFF;
  --skyfi-dark: #5539d9;
  --skyfi-soft: #eeeaff;
  --bg: #f7f7fb;
  --panel: #ffffff;
  --text: #222831;
  --muted: #8a8fa3;
  --border: #e5e7f0;
  --danger: #d94848;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(107, 78, 255, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--skyfi);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #fafbff;
  outline: none;
  transition: border-color .15s, background .15s;
}

.field input:focus {
  border-color: var(--skyfi);
  background: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--skyfi);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s;
}

.btn:hover { background: var(--skyfi-dark); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-block { width: 100%; margin-top: 6px; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: #f0f1f7; color: var(--text); }

.error {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  background: #fdecec;
  color: var(--danger);
  border-radius: 8px;
  font-size: 14px;
}
.error.show { display: block; }

/* ---------- CHAT ---------- */
.chat-wrap {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar .brand { margin: 0; font-size: 17px; }
.topbar .brand-icon { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-info {
  font-size: 14px;
  color: var(--muted);
}
.user-info strong { color: var(--text); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 72%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg.user {
  align-self: flex-end;
  background: var(--skyfi);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg.system {
  align-self: center;
  background: var(--skyfi-soft);
  color: var(--skyfi-dark);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 20px;
}

.typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.typing span {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.composer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  background: var(--panel);
  display: flex;
  gap: 10px;
}

.composer textarea {
  flex: 1;
  resize: none;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  outline: none;
  background: #fafbff;
  max-height: 140px;
}
.composer textarea:focus {
  border-color: var(--skyfi);
  background: #fff;
}
