:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --line: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #2563eb;
  --accent-2: #f59e0b;
  --danger: #ef4444;
  --ok: #10b981;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, #1e3a8a 0, transparent 35%),
    radial-gradient(circle at 80% 0%, #78350f 0, transparent 28%),
    var(--bg);
}
.login-card {
  width: 420px;
  background: #111827ee;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px #0006;
}
.login-card h1 { margin: 0 0 8px; font-size: 26px; }
.login-card p { color: var(--muted); line-height: 1.6; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #fff;
  background: var(--accent);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.gold { background: #c05621; }
.btn.block { width: 100%; margin-top: 18px; height: 44px; }

.app {
  height: 100%;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.brand {
  padding: 18px 16px 10px;
}
.brand h1 { font-size: 18px; margin: 0; }
.brand .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.side-actions { padding: 0 12px 12px; display: flex; gap: 8px; }
.conv-list {
  flex: 1;
  overflow: auto;
  padding: 8px;
}
.conv-item {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 6px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.conv-item:hover { background: var(--panel-2); }
.conv-item.active { background: #1e3a8a; }
.conv-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .del { color: var(--muted); background: none; border: 0; cursor: pointer; }
.userbox {
  border-top: 1px solid var(--line);
  padding: 12px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #0b1220;
}
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.status { color: var(--muted); font-size: 13px; }
.messages {
  flex: 1;
  overflow: auto;
  padding: 20px 24px 8px;
}
.msg {
  max-width: 860px;
  margin: 0 auto 16px;
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user { background: #1e3a8a; }
.msg.assistant { background: #111827; border: 1px solid var(--line); }
.msg table { border-collapse: collapse; width: 100%; font-size: 13px; white-space: normal; }
.msg th, .msg td { border: 1px solid #334155; padding: 6px 8px; text-align: left; }
.msg thead { background: #1f2937; }
.composer {
  border-top: 1px solid var(--line);
  padding: 12px 16px 16px;
}
.attachments { min-height: 0; display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.input-row { display: flex; gap: 8px; align-items: flex-end; }
textarea {
  flex: 1;
  min-height: 48px;
  max-height: 160px;
  resize: vertical;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
}
.hidden { display: none; }
.error { color: #fecaca; background: #7f1d1d55; padding: 8px 12px; border-radius: 8px; margin: 8px 24px; }
