:root {
  --bg: #f6f4ef; --panel: #fff; --ink: #1f2430; --muted: #6b7280; --line: #e5e1d8;
  --accent: #8a1c2b; --accent-soft: #f3e6e8; --ok: #1f7a4d; --warn: #b45309;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14161b; --panel: #1d2027; --ink: #e8e6e1; --muted: #9aa0aa; --line: #2c3039; --accent: #d4626f; --accent-soft: #3a2328; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); text-decoration: none; }
.top { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
nav a { color: var(--muted); } nav a.on { color: var(--accent); font-weight: 600; }
#who { color: var(--muted); font-size: 14px; }
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 26px; margin: 8px 0 4px; } h2 { font-size: 18px; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.card h3 { margin: 0 0 6px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: #e3f3ea; color: var(--ok); } .tag.warn { background: #fdf0e1; color: var(--warn); }
button, .btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font: inherit; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); width: 100%; }
label { display: block; margin: 10px 0 4px; font-size: 14px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
code, pre { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
pre { background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; }
.login { max-width: 360px; margin: 60px auto; }
.err { color: #c0392b; font-size: 14px; min-height: 1.4em; }

/* chat */
.chat { display: grid; grid-template-columns: 240px 1fr; gap: 16px; height: calc(100vh - 120px); }
.side { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; overflow-y: auto; }
.side .conv { padding: 8px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; }
.side .conv.on, .side .conv:hover { background: var(--accent-soft); }
.side .conv span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .conv .ops { visibility: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; }
.side .conv:hover .ops { visibility: visible; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 0; }
.pane .bar { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.pane .bar select { width: auto; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; }
.msg { margin: 0 0 14px; max-width: 85%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.msg.user { margin-left: auto; background: var(--accent-soft); }
.msg.assistant { background: var(--bg); }
.msg img { max-width: 220px; border-radius: 8px; display: block; margin-top: 6px; }
.composer { border-top: 1px solid var(--line); padding: 10px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { resize: none; height: 60px; }
.attach { font-size: 12px; color: var(--muted); }
@media (max-width: 720px) { .chat { grid-template-columns: 1fr; height: auto; } .side { max-height: 180px; } .pane { height: 70vh; } }
