* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f2f3f5;
}

.app {
  width: 900px;
  height: 80vh;
  display: flex;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.sidebar {
  width: 240px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e5e5e5;
  background: #fafafa;
}

.new-chat-btn {
  margin: 12px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #4f7cff;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.new-chat-btn:hover {
  background: #3d67e0;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}

.chat-list-item {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.chat-list-item:hover {
  background: #ececec;
}

.chat-list-item.active {
  background: #e4eaff;
  color: #2d4fd6;
  font-weight: 600;
}

.chat {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px;
  border-bottom: 1px solid #e5e5e5;
}

.chat-header button {
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 16px;
  background: #fff;
  color: #555;
  font-size: 13px;
  cursor: pointer;
}

.chat-header button:hover {
  background: #f2f3f5;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.user {
  align-self: flex-end;
  background: #4f7cff;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: #ececec;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.message.error {
  align-self: center;
  background: #ffe1e1;
  color: #b00000;
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e5e5e5;
}

.chat-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}

.chat-input input:focus {
  border-color: #4f7cff;
}

.chat-input button {
  padding: 10px 20px;
  border: none;
  border-radius: 20px;
  background: #4f7cff;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.chat-input button:disabled {
  opacity: 0.6;
  cursor: default;
}

.chat-input button:hover:not(:disabled) {
  background: #3d67e0;
}

.login-box {
  width: 320px;
  padding: 32px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
  margin: 0 0 20px;
  font-size: 20px;
  text-align: center;
}

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

.login-form input {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.login-form input:focus {
  border-color: #4f7cff;
}

.login-form button {
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #4f7cff;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.login-form button:hover:not(:disabled) {
  background: #3d67e0;
}

.login-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

.login-error {
  color: #b00000;
  font-size: 13px;
  min-height: 16px;
  text-align: center;
}
