:root { --ink: #1f2328; --muted: #6b7280; --line: #e5e7eb; --bg: #fafaf9; --card: #fff; --accent: #2f6f5e; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
main { max-width: 40rem; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; padding: 0 1rem; }
button { font: inherit; border: 0; border-radius: 0.6rem; padding: 0.7rem 1.1rem; background: var(--accent); color: #fff; cursor: pointer; }
button.quiet { background: transparent; color: var(--accent); border: 1px solid var(--line); padding: 0.45rem 0.8rem; }
button:disabled { opacity: 0.5; cursor: default; }
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 1rem; padding: 2rem 0; }
.center h1 { font-size: 1.6rem; margin: 0; font-weight: 600; }
.center p { color: var(--muted); margin: 0; max-width: 28rem; }
.center blockquote { margin: 0; max-width: 28rem; padding: 0.6rem 0.9rem; border-left: 4px solid #b7c9c3; background: #f3f8f6; font-style: italic; text-align: left; white-space: pre-wrap; }
.who-line { display: flex; align-items: center; gap: 0.45rem; color: var(--ink) !important; }
.big { font-size: 1.1rem; padding: 0.9rem 1.6rem; }
.small { font-size: 0.82rem; color: var(--muted); }
.room { display: flex; flex-direction: column; flex: 1; min-height: 100vh; }
header { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.8rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 0.45rem; font-size: 0.92rem; }
.who small { color: var(--muted); }
.dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; display: inline-block; flex: none; background: #d1d5db; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 0.85em; color: var(--muted); }
#panel { margin: 0.8rem 0; padding: 0.8rem; border: 1px dashed #b7c9c3; border-radius: 0.8rem; background: #f3f8f6; display: flex; flex-direction: column; gap: 0.5rem; }
#panel p { margin: 0; font-size: 0.92rem; }
.panel-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.9rem; }
.badge { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.15rem 0.5rem; border-radius: 999px; background: #d1fae5; color: #065f46; }
.badge.revoked, .badge.expired, .badge.closed, .badge.spent { background: #fee2e2; color: #991b1b; }
.badge.claimed { background: #e0e7ff; color: #3730a3; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.row input { flex: 1; min-width: 10rem; font: 0.85rem ui-monospace, Consolas, monospace; padding: 0.55rem; border: 1px solid var(--line); border-radius: 0.5rem; background: #fff; }
#revoke-msg { font-family: inherit; }
#panel-history { margin: 0; padding: 0 0 0 1rem; font-size: 0.8rem; color: var(--muted); }
#panel-history:empty { display: none; }
#log { flex: 1; overflow-y: auto; padding: 0.8rem 0; display: flex; flex-direction: column; gap: 0.4rem; }
.msg { max-width: 80%; padding: 0.5rem 0.75rem; border-radius: 0.9rem; white-space: pre-wrap; word-wrap: break-word; background: var(--card); border: 1px solid var(--line); }
.msg.mine { align-self: flex-end; color: #fff; border: 0; }
.msg time { display: block; font-size: 0.72rem; opacity: 0.7; margin-top: 0.15rem; }
.note { align-self: center; color: var(--muted); font-size: 0.82rem; }
#composer { display: flex; gap: 0.5rem; padding: 0.7rem 0 1rem; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--bg); }
textarea { flex: 1; font: inherit; resize: none; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 0.6rem; min-height: 2.8rem; max-height: 9rem; }
#status { font-size: 0.78rem; color: var(--muted); text-align: center; min-height: 1em; }
footer { font-size: 0.78rem; color: var(--muted); text-align: center; padding: 0 0 0.8rem; }
footer a { color: inherit; }
[hidden] { display: none !important; }
/* header: Them on the left, You on the right, like the bubbles */
header .who.me { margin-left: auto; text-align: right; }
header .who.them { margin-right: auto; }
/* messages: text, attachments, cards */
.msg .text { white-space: pre-wrap; }
.msg a { color: inherit; text-decoration: underline; word-break: break-all; }
.msg.mine { max-width: 85%; }
.thumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }
.thumb { padding: 0; border: 0; background: #e5e7eb; border-radius: 0.5rem; overflow: hidden; width: 9.5rem; height: 7rem; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.75rem; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.broken { background: #fee2e2; color: #991b1b; }
.file-card, .hs-card, .preview-card { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.4rem; padding: 0.5rem 0.6rem; border-radius: 0.6rem; background: #fff; color: var(--ink); border: 1px solid var(--line); white-space: normal; text-decoration: none !important; }
.file-icon { font-size: 1.4rem; flex: none; }
.file-meta, .hs-meta, .preview-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta small, .hs-meta small, .preview-site { color: var(--muted); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; }
.file-actions { display: flex; gap: 0.3rem; flex: none; }
.file-actions button { padding: 0.3rem 0.6rem; font-size: 0.82rem; background: #fff; }
.hs-icon { flex: none; width: 2rem; height: 2rem; border-radius: 0.45rem; background: #0b5394; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; }
.hs-icon.ch { background: var(--accent); font-size: 0.7rem; }
.hs-icon.warn { background: #b45309; }
.hs-badges { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 0.2rem; }
.badge.unknown { background: #f3f4f6; color: #374151; }
.badge.secret { background: #fef3c7; color: #92400e; }
.badge.env { background: #ede9fe; color: #5b21b6; }
.hs-open { flex: none; font-size: 0.82rem; padding: 0.35rem 0.6rem; border-radius: 0.5rem; background: #0b5394; color: #fff !important; text-decoration: none !important; }
.hs-card.channels-invite { border-color: #f59e0b; background: #fffbeb; }
.preview-card { align-items: stretch; flex-direction: column; gap: 0.3rem; color: var(--ink) !important; }
.preview-img { width: 100%; max-height: 11rem; object-fit: cover; border-radius: 0.4rem; background: #f3f4f6; }
.preview-title { font-size: 0.92rem; }
.preview-desc { font-size: 0.82rem; color: #374151; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.preview-card.loading { color: var(--muted) !important; font-size: 0.82rem; }
/* composing */
/* The extras ride in the sticky composer, above the text box, so warnings and previews are always in view. */
#composer { flex-wrap: wrap; row-gap: 0.45rem; align-items: flex-end; }
#compose-extras { flex: 1 0 100%; display: flex; flex-direction: column; gap: 0.35rem; max-height: 38vh; overflow-y: auto; }
#compose-extras:not(:has(#warnings:not(:empty), #draft-preview:not([hidden]), #tray:not(:empty))) { display: none; }
#warnings:empty, #tray:empty { display: none; }
.warn { margin: 0; font-size: 0.82rem; padding: 0.45rem 0.6rem; border-radius: 0.5rem; background: #fffbeb; border: 1px solid #f59e0b; color: #92400e; }
#draft-preview { position: relative; }
#draft-preview .preview-card, #draft-preview .hs-card { margin-top: 0; padding-right: 2.2rem; }
.draft-x, .chip-x { position: absolute; top: 0.3rem; right: 0.3rem; padding: 0.1rem 0.5rem; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; line-height: 1.2; }
#tray { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { position: relative; display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 2rem 0.3rem 0.55rem; border-radius: 0.5rem; background: #fff; border: 1px solid var(--line); font-size: 0.82rem; max-width: 100%; }
.chip-x { top: 50%; transform: translateY(-50%); }
.chip-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip small { color: var(--muted); }
.chip.error { border-color: #fca5a5; background: #fef2f2; }
.chip-error { color: #991b1b !important; }
.chip-ok { color: #065f46 !important; }
.chip progress { width: 5rem; height: 0.5rem; }
button.icon { padding: 0.45rem 0.6rem; font-size: 1.1rem; align-self: flex-end; }
#drop-hint { position: fixed; inset: 0; background: rgba(47, 111, 94, 0.12); border: 3px dashed var(--accent); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; color: var(--accent); pointer-events: none; z-index: 10; }
