* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #222;
}

.shell {
  max-width: 1300px;
  margin: 20px auto;
  padding: 0 16px;
}

.auth-card {
  max-width: 420px;
  margin: 80px auto;
  background: #fff;
  border: 1px solid #d8dee6;
  border-radius: 12px;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  min-height: 85vh;
}

.sidebar,
.chat-panel {
  background: #fff;
  border: 1px solid #d8dee6;
  border-radius: 12px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header,
.chat-panel-header {
  padding: 16px;
  border-bottom: 1px solid #e5e9ef;
  font-weight: bold;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-list {
  overflow-y: auto;
  padding: 8px;
}

.chat-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  border: 1px solid #e5e9ef;
}

.chat-item.active {
  background: #eaf3ff;
  border-color: #9fc2ff;
}

.chat-item-name {
  font-weight: bold;
  margin-bottom: 6px;
}

.chat-item-text {
  color: #666;
  font-size: 14px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f9fbfc;
}

.msg {
  max-width: 75%;
  margin-bottom: 12px;
}

.msg.left {
  margin-right: auto;
}

.msg.right {
  margin-left: auto;
}

.meta {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.bubble {
  padding: 10px 12px;
  border-radius: 10px;
  line-height: 1.4;
  word-break: break-word;
}

.msg.left .bubble {
  background: #e8edf3;
}

.msg.right .bubble {
  background: #d7f0db;
}

.message-form {
  display: flex;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid #e5e9ef;
}

input {
  flex: 1;
  padding: 12px;
  border: 1px solid #cdd6df;
  border-radius: 8px;
  font-size: 16px;
}

button {
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: #1f6feb;
  color: #fff;
  cursor: pointer;
}

.hidden {
  display: none;
}

.empty-state {
  color: #666;
  padding: 20px;
}

.error {
  color: #c62828;
  min-height: 20px;
}

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

  .sidebar {
    min-height: 220px;
  }

  .msg {
    max-width: 90%;
  }

  .message-form {
    flex-direction: column;
  }
}
