:root {
  --bg: #f3f7fb;
  --panel: #ffffff;
  --line: #dbe5f0;
  --text: #10243b;
  --subtle: #64748b;
  --accent: #0f766e;
  --warn: #b45309;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 10% 0%, #dbeafe 0%, #eef6ff 35%, #f0fdfa 100%);
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.chat-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 0;
}

.left-panel,
.right-panel,
.main-panel {
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.right-panel {
  border-right: none;
  border-left: 1px solid var(--line);
}

.left-panel,
.right-panel {
  padding: 14px;
  overflow-y: auto;
}

.left-panel h2,
.right-panel h2 {
  margin: 4px 0 14px;
  font-size: 20px;
}

.left-panel h3 {
  margin: 14px 0 8px;
  font-size: 14px;
  color: var(--subtle);
}

.create-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.create-box input {
  width: 100%;
  border: 1px solid #bfd1e6;
  border-radius: 8px;
  padding: 8px 10px;
}

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

button.warn { background: var(--warn); }
button.danger { background: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.home-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #f8fbff;
}

.room-item.active {
  border-color: #0ea5e9;
  background: #eaf7ff;
}

.room-item .title {
  font-size: 14px;
  font-weight: 700;
}

.room-item .meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--subtle);
}

.room-item .actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.room-item .actions button {
  padding: 6px 8px;
  font-size: 12px;
}

.main-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #eff6ff, #f0fdfa);
}

.top-bar h1 {
  margin: 0;
  font-size: 22px;
}

.top-bar p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--subtle);
}

.top-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.me { font-size: 12px; color: var(--subtle); }

.state {
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid;
  padding: 4px 8px;
}

.state.connected {
  color: #065f46;
  border-color: #10b981;
  background: #ecfdf5;
}

.state.disconnected {
  color: #9f1239;
  border-color: #fb7185;
  background: #fff1f2;
}

.notice {
  min-height: 24px;
  padding: 8px 16px;
  color: var(--danger);
  border-bottom: 1px solid var(--line);
}

.current-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px 12px;
}

.msg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--subtle);
  font-size: 12px;
}

.msg-content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}

.system {
  font-size: 12px;
  color: #0f766e;
}

.composer {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #fbfeff;
}

.composer textarea {
  flex: 1;
  resize: vertical;
  border: 1px solid #bfd1e6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #f8fbff;
}

.member-item .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 6px;
  border: 1px solid;
}

.badge.online {
  color: #065f46;
  border-color: #34d399;
  background: #ecfdf5;
}

.badge.offline {
  color: #9f1239;
  border-color: #fda4af;
  background: #fff1f2;
}

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

  .right-panel {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .left-panel,
  .right-panel {
    max-height: 280px;
  }

  .main-panel {
    min-height: 60vh;
  }
}
