.chat-head { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 2px solid var(--edge); background: var(--card); min-height: 58px; }
.back-link { display: none; color: var(--link); white-space: nowrap; font-weight: 800; }
.chat-meta { flex: 1; min-width: 0; }
.chat-title { font-weight: 900; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leave { white-space: nowrap; padding: 4px 11px; border: 2px solid var(--edge); border-radius: 12px; background: var(--hover); font-weight: 800; font-size: 12px; box-shadow: 2px 2px 0 var(--shadow-c); }
.leave:active { transform: translate(2px, 2px); box-shadow: none; }

.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 10px 14px; display: flex; flex-direction: column; background-color: var(--soft); background-image: radial-gradient(var(--dot) 1.2px, transparent 1.5px); background-size: 16px 16px; }
.day { display: flex; justify-content: center; margin: 14px 0 8px; }
.day span { color: var(--ink); font-size: 11px; font-weight: 800; background: var(--mint); color: #1f1b16; border: 2px solid var(--edge); border-radius: 12px; padding: 2px 12px; transform: rotate(-1.5deg); box-shadow: 2px 2px 0 var(--shadow-c); }
.m { display: flex; gap: 11px; padding: 5px 8px; }
.m-gap { width: 38px; flex: none; }
.m-body { min-width: 0; flex: 1; }
.m-top { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.m-name { font-weight: 900; color: hsl(var(--hue, 20) 70% var(--name-l)); }
.m-time { color: var(--muted); font-size: 11px; }
.m-txt { display: inline-block; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--card); border: 2px solid var(--edge); border-radius: 4px 14px 14px 14px; padding: 5px 11px; box-shadow: 2px 2px 0 var(--shadow-c); }
.m.mine .m-txt { background: var(--yellow); color: #1f1b16; border-radius: 14px 4px 14px 14px; }
.m-pic { display: block; max-width: min(100%, 420px); max-height: 340px; border: 2px solid var(--edge); border-radius: 12px; margin: 4px 0; cursor: zoom-in; box-shadow: 3px 3px 0 var(--shadow-c); }
.m-pic + .m-txt { margin-top: 4px; }

.attach-prev { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-top: 2px dashed var(--edge); background: var(--card); }
.attach-prev img { width: 48px; height: 48px; object-fit: cover; border: 2px solid var(--edge); border-radius: 8px; }
.attach-prev span { flex: 1; color: var(--muted); }
.composer { border-top: 2px solid var(--edge); background: var(--card); padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.composer textarea { display: block; width: 100%; resize: none; min-height: 56px; max-height: 160px; padding: 10px 12px; border: 2px solid var(--edge); border-radius: 12px; background: var(--input); }
.composer textarea:focus { outline: none; box-shadow: 3px 3px 0 var(--sky); }
.composer-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.attach-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--link); font-weight: 700; padding: 5px 8px; border-radius: 8px; }
.attach-btn:hover { background: var(--hover); }
.readonly { text-align: center; color: var(--muted); font-weight: 600; padding: 16px; border-top: 2px solid var(--edge); background: var(--card); }
.chat > .chat-empty { margin: auto; }
.msgs > .chat-empty { margin: auto; }

@media (max-width: 800px) { .back-link { display: block; } }
