:root {
  --bg: #eef3f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #d7e0ea;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --danger: #dc2626;
  --shadow: 0 18px 60px rgba(15, 23, 42, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei UI", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.16), transparent 32%),
    linear-gradient(135deg, #eef3f9, #f8fafc);
  color: var(--text);
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  background: var(--blue);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:hover { filter: brightness(.96); }
button:disabled { opacity: .55; cursor: not-allowed; }

button.secondary {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--line);
}

button.small {
  padding: 8px 12px;
  border-radius: 10px;
}

button.full { width: 100%; }

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
  font-size: 15px;
  background: white;
}

input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: center;
  padding: 28px 0;
}

.brand-card, .auth-card, .chat-layout {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(215,224,234,.9);
  box-shadow: var(--shadow);
  border-radius: 24px;
}

.brand-card { padding: 34px; }

.badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
  margin-bottom: 18px;
}

h1 {
  font-size: 42px;
  line-height: 1.05;
  margin: 0 0 14px;
}

h2 { margin: 0; }

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

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.feature-grid span {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  font-weight: 700;
}

.auth-card {
  max-width: 500px;
  margin: 0 auto;
  padding: 30px;
}

.auth-card label {
  display: block;
  margin: 16px 0 8px;
  font-weight: 700;
}

.auth-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.message {
  min-height: 22px;
  color: var(--danger);
}

.hidden { display: none !important; }

.chat-layout {
  height: min(760px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: 310px 1fr;
  overflow: hidden;
}

.side-panel {
  border-right: 1px solid var(--line);
  padding: 18px;
  background: rgba(248,250,252,.72);
  overflow-y: auto;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  background: #f8fafc;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 9px 8px;
}

.tab.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.section-title {
  font-weight: 800;
  margin: 12px 0;
}

.quick-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  border: 1px solid var(--line);
  background: white;
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
}

.item-card:hover, .item-card.active {
  border-color: #60a5fa;
  background: #eff6ff;
}

.item-name {
  font-weight: 800;
  word-break: break-word;
}

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

.notice-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.notice-actions button {
  flex: 1;
  padding: 8px;
}

.conversation-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.conversation-header {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.message-list {
  padding: 20px;
  overflow-y: auto;
  background: #f8fafc;
}

.bubble {
  max-width: 78%;
  margin-bottom: 12px;
  padding: 11px 13px;
  border-radius: 16px;
  background: white;
  border: 1px solid var(--line);
}

.bubble.mine {
  margin-left: auto;
  background: #dbeafe;
  border-color: #bfdbfe;
}

.bubble .sender {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.bubble .content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.system-msg {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 10px 0;
}

.send-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: white;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  z-index: 20;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: 18px;
  }

  .brand-card { padding: 24px; }

  h1 { font-size: 32px; }

  .chat-layout {
    height: auto;
    min-height: calc(100vh - 24px);
    grid-template-columns: 1fr;
  }

  .side-panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: none;
  }

  .item-list {
    max-height: 260px;
    overflow-y: auto;
  }

  .conversation-panel { min-height: 520px; }

  .bubble { max-width: 92%; }
}
