:root {
  --bg: #f6f3ef; --panel: #ffffff; --ink: #2b2622; --muted: #8a8079; --line: #e6dfd8;
  --owner: #2b2622; --owner-ink: #ffffff; --agent: #ffffff; --accent: #b4552d; --ok: #3f7d4f;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171412; --panel: #221e1b; --ink: #f1ebe5; --muted: #9b9089; --line: #36302b; --owner: #f1ebe5; --owner-ink: #171412; --agent: #2a2522; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; }
#app { max-width: 760px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.hint { padding: 32px 16px; color: var(--muted); text-align: center; }
header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
header h1 { margin: 0; font-size: 18px; flex: 1; }
header button, .row button, .composer button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px; padding: 7px 12px; font: inherit; font-size: 14px; }
header .back { padding: 6px 10px; }
.status { font-size: 13px; color: var(--muted); }
.status.busy { color: var(--accent); }
.list { padding: 8px 16px; display: flex; flex-direction: column; gap: 10px; }
.card { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.card .name { font-weight: 600; display: flex; justify-content: space-between; }
.card .preview { color: var(--muted); font-size: 14px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 16px 16px; }
.msgs { flex: 1; padding: 12px 12px 4px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 86%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); }
.msg.owner { align-self: flex-end; background: var(--owner); color: var(--owner-ink); border-color: transparent; }
.msg.agent { align-self: flex-start; background: var(--agent); }
.msg .meta { display: block; font-size: 11px; opacity: .6; margin-top: 4px; }
.msg img { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; margin-top: 6px; }
.composer { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px); background: var(--bg); border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 160px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font: inherit; background: var(--panel); color: var(--ink); }
.composer .send { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.composer input[type=file] { display: none; }
.thumbs { display: flex; gap: 6px; padding: 0 12px; flex-wrap: wrap; }
.thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; font-size: 14px; max-width: 90%; }
.linkbox { margin: 0 16px 16px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; font-size: 13px; word-break: break-all; }
