:root {
  color-scheme: light;
  font-family: "Segoe UI", "Arial", sans-serif;
  --bg: #f3f5f7;
  --card: #ffffff;
  --line: #d8dee4;
  --text: #111827;
  --muted: #6b7280;
  --accent: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #e6f5f2, var(--bg));
  color: var(--text);
}

.chat-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.chat-card {
  width: min(860px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 78vh;
}

.chat-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.chat-header h1 {
  margin: 0;
  font-size: 22px;
}

.status {
  margin: 6px 0 2px;
  color: var(--muted);
  font-size: 14px;
}

.account {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.auth-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.auth-error {
  margin: 0 0 12px;
  min-height: 1.2em;
  color: #b91c1c;
  font-size: 14px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.auth-form {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.auth-form h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.auth-form label {
  font-size: 13px;
  color: var(--muted);
}

.chat-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
}

.message-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}

input,
button {
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14px;
}

input {
  padding: 10px 12px;
}

button {
  padding: 10px 14px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
}

.ghost-btn {
  background: #fff;
  color: var(--accent);
}

button:disabled,
input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.messages {
  margin: 0;
  padding: 10px 20px 16px;
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

.message-item {
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f4;
  line-height: 1.35;
  word-break: break-word;
}

.message-item.system {
  color: var(--muted);
  font-style: italic;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .chat-card {
    min-height: 92vh;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .message-form {
    grid-template-columns: 1fr;
  }
}
