/* LockIn Messages. Builds on /web/assets/lockin.css tokens: warm black, one flat yellow accent, Archivo. */
:root { --shadow: 0 18px 44px rgba(0, 0, 0, .55); --mine: var(--accent); --mine-ink: var(--accent-ink); --theirs: var(--raised); --lp-w: 360px; }
html, body { height: 100%; overflow: hidden; }
body { font-size: 14px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.grow { flex: 1; min-width: 0; }
button { -webkit-tap-highlight-color: transparent; }
.icon { width: 34px; height: 34px; border: 0; background: transparent; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; padding: 0; text-decoration: none; }
.icon:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.icon:disabled { opacity: .4; cursor: default; background: transparent; }
.icon[aria-expanded="true"] { background: var(--raised); color: var(--text); }
.spin { width: 20px; height: 20px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
.spin.sm { width: 13px; height: 13px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand .mark { width: 30px; height: 30px; flex: none; border-radius: 4px; background: var(--accent); display: grid; place-items: center; }
.brand .mark svg { width: 18px; height: 18px; fill: var(--accent-ink); }
.brand .word { font-stretch: 62%; font-weight: 900; font-size: 28px; line-height: 1; letter-spacing: .4px; text-transform: uppercase; }

/* ---------- boot + signed out ---------- */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); background: var(--bg); z-index: 50; padding: 16px; text-align: center; }
.boot-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.gate { position: fixed; inset: 0; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.gate-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 26px 22px; }
.gate-card .brand .mark { width: 26px; height: 26px; }
.gate-card .brand .mark svg { width: 15px; height: 15px; }
.gate-card .brand .word { font-size: 22px; }
.gate-ic { width: 48px; height: 48px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 26px 0 14px; }
.gate-ic .ic { width: 24px; height: 24px; }
.gate h1 { font-size: 40px; margin: 0 0 8px; }
.gate p { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }
.gate-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.gate-acts .btn { flex: 1; min-width: 150px; }
.gate-facts { list-style: none; padding: 16px 0 0; margin: 20px 0 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.gate-facts li { display: flex; gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.gate-facts .ic { width: 16px; height: 16px; color: var(--faint); margin-top: 1px; }

/* ---------- app frame ---------- */
.mapp { display: grid; grid-template-columns: var(--lp-w) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.lp { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tp { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

/* ---------- list pane ---------- */
.lp-top { height: 56px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px 0 12px; }
.lp-top .brand { margin-right: 6px; }
.lp-top .brand .mark { width: 28px; height: 28px; }
.lp-title { margin: 0; font-size: 26px; white-space: nowrap; }
.newchat { margin-left: 4px; padding: 6px 10px 6px 8px; }
.newchat .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.lp-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); flex: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; padding: 9px 10px 10px; cursor: pointer; letter-spacing: .1px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.tcount { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--raised); color: var(--muted); font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; line-height: 1; }
.tcount.hot { background: var(--accent); color: var(--accent-ink); }
.lp-search { display: flex; align-items: center; gap: 8px; margin: 10px 12px 6px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--faint); flex: none; }
.lp-search:focus-within { border-color: var(--accent); color: var(--muted); }
.lp-search .ic { width: 15px; height: 15px; }
.lp-search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; color: var(--text); font-size: 13.5px; padding: 0; }
.lp-search input::placeholder { color: var(--faint); }
.lp-search input::-webkit-search-cancel-button { filter: invert(.6); }
.netbar { display: flex; align-items: center; gap: 8px; margin: 2px 12px 4px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--raised); color: var(--warn); font-size: 12.5px; font-weight: 600; flex: none; }
.clist { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 6px 10px; overscroll-behavior: contain; }
.ci { position: relative; width: 100%; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text); }
.ci:hover { background: var(--raised); }
.ci.on { background: var(--raised); }
.ci.on::before { content: ""; position: absolute; left: -6px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 2px 2px 0; background: var(--accent); }
.ci-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ci-r1, .ci-r2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ci-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { flex: none; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.ci-prev { flex: 1; min-width: 0; font-size: 13px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-prev .ic { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.ci-badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 800; display: grid; place-items: center; font-variant-numeric: tabular-nums; line-height: 1; }
.ci-tag { flex: none; font-size: 10.5px; font-weight: 750; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 3px; padding: 1px 5px; line-height: 1.4; }
.ci-tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.ci.unread .ci-name { font-weight: 800; }
.ci.unread .ci-prev { color: var(--text); }
.ci.unread .ci-time { color: var(--accent); font-weight: 700; }
.clist-empty { padding: 34px 18px; text-align: center; color: var(--faint); font-size: 13px; line-height: 1.5; }
.clist-empty b { display: block; color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.clist-empty .btn { margin-top: 12px; }
.clist-sec { font-size: 11px; font-weight: 750; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); padding: 12px 10px 4px; }
.lp-foot { flex: none; display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--line); min-height: 52px; }
.lp-foot #lockin-hud { min-width: 0; overflow: hidden; }
.lp-foot .li-user > span:last-child { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-foot .icon { width: 32px; height: 32px; }
.lp-foot .icon .ic { width: 17px; height: 17px; }
.mapp .li-msg { display: none !important; }

/* avatars: neutral squares with an initial; groups get a stacked look */
.av { position: relative; width: 40px; height: 40px; flex: none; border-radius: var(--radius); background: var(--raised); border: 1px solid var(--line-strong); color: var(--text); display: grid; place-items: center; font-weight: 800; font-size: 16px; text-transform: uppercase; line-height: 1; user-select: none; }
.ci.on .av, .ci:hover .av { background: #232327; }
.av.group { background: var(--accent-soft); border-color: #4a3f0e; color: var(--accent); font-size: 13.5px; letter-spacing: .3px; }
.av.group .ic { width: 19px; height: 19px; }
.av.gone { color: var(--faint); }
.av.sm { width: 28px; height: 28px; font-size: 12px; border-radius: var(--radius-sm); }
.av.xs { width: 24px; height: 24px; font-size: 11px; border-radius: var(--radius-sm); }

/* ---------- empty thread pane ---------- */
.tp-empty { flex: 1; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.te-in { width: min(520px, 100%); }
.te-ic { width: 52px; height: 52px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin-bottom: 16px; }
.te-ic .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.tp-empty h2 { margin: 0 0 8px; font-size: 38px; }
.tp-empty p { margin: 0 0 18px; color: var(--muted); font-size: 15px; max-width: 440px; }
.te-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.te-acts .ic { width: 15px; height: 15px; }
.te-tips { list-style: none; margin: 28px 0 0; padding: 0; border-top: 1px solid var(--line); }
.te-tips li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.te-tips b { font-size: 11.5px; font-weight: 750; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); padding-top: 1px; }
.te-tips span { color: var(--muted); }

/* ---------- thread ---------- */
.th { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.th-top { height: 56px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg); }
.th-top .back { display: none; margin-left: -6px; }
.th-who { display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: transparent; color: var(--text); padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.th-who:hover { background: var(--panel); }
.th-who .av { width: 36px; height: 36px; font-size: 15px; }
.th-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.th-names b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-names small { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-names small.ok { color: var(--ok); }

.th-notice { flex: none; border-bottom: 1px solid var(--line); background: var(--panel); padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; }
.th-notice .n-ic { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.th-notice .n-ic .ic { width: 17px; height: 17px; }
.th-notice .n-ic.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.th-notice .n-ic.bad { background: var(--danger-soft); color: var(--danger); }
.th-notice .n-txt { flex: 1; min-width: 0; }
.th-notice .n-txt b { color: var(--text); }
.th-notice .n-txt p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.th-notice .n-txt p:first-child { color: var(--text); font-weight: 600; margin-bottom: 2px; }
.th-notice .n-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.th-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; }
.th-list { padding: 18px 22px 10px; display: flex; flex-direction: column; min-height: 100%; justify-content: flex-end; }
.th-start { text-align: center; padding: 18px 12px 22px; color: var(--faint); font-size: 12.5px; }
.th-start .av { width: 56px; height: 56px; font-size: 22px; margin: 0 auto 10px; }
.th-start b { display: block; color: var(--text); font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.th-more { display: flex; justify-content: center; padding: 6px 0 14px; }
.day { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; font-size: 11.5px; font-weight: 700; color: var(--faint); letter-spacing: .6px; text-transform: uppercase; }
.day::before, .day::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.day.new { color: var(--accent); }
.day.new::before, .day.new::after { border-top-color: #4a3f0e; }
.sys { align-self: center; max-width: 85%; text-align: center; font-size: 12.5px; color: var(--faint); margin: 6px 0; line-height: 1.4; }
.sys b { color: var(--muted); font-weight: 650; }

/* message rows */
.mg { display: flex; gap: 8px; margin: 2px 0 0; align-items: flex-end; }
.mg + .mg { margin-top: 10px; }
.mg.me { flex-direction: row-reverse; }
.mg .av { margin-bottom: 18px; }
.mg-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(600px, 74%); }
.mg.me .mg-body { align-items: flex-end; }
.mg-from { font-size: 12px; font-weight: 650; color: var(--muted); margin: 0 0 3px 2px; }
.mg-from small { font-weight: 500; color: var(--faint); margin-left: 4px; }
.m { position: relative; display: flex; align-items: center; gap: 4px; max-width: 100%; margin-top: 2px; }
.mg.me .m { flex-direction: row-reverse; }
.bub { min-width: 0; max-width: 100%; background: var(--theirs); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; padding: 7px 12px 8px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.mg:not(.me) .m:not(:first-of-type) .bub { border-top-left-radius: 3px; }
.mg:not(.me) .m:not(:last-child) .bub { border-bottom-left-radius: 3px; }
.mg.me .bub { background: var(--mine); color: var(--mine-ink); border-color: var(--mine); }
.mg.me .m:not(:first-of-type) .bub { border-top-right-radius: 3px; }
.mg.me .m:not(:last-child) .bub { border-bottom-right-radius: 3px; }
.mg-body .m:first-of-type .bub, .mg-body > .mg-from + .m .bub { border-top-left-radius: 10px; }
.mg.me .mg-body .m:first-of-type .bub { border-top-right-radius: 10px; }
.bub a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; word-break: break-all; }
.mg.me .bub a { color: var(--accent-ink); font-weight: 650; }
.bub .m-link.off { color: var(--muted); text-decoration: underline dotted; text-underline-offset: 2px; word-break: break-all; cursor: help; }
.bub.big { font-size: 30px; line-height: 1.2; background: transparent; border-color: transparent; padding: 0 2px; }
.mg.me .bub.big { color: var(--text); }
.m.deleted .bub { background: transparent; color: var(--faint); border: 1px dashed var(--line-strong); font-style: italic; font-size: 13px; padding: 5px 11px; }
.m.deleted .bub .ic { display: inline-block; width: 13px; height: 13px; vertical-align: -2px; margin-right: 5px; }
.m.pending .bub { opacity: .62; }
.m.failed .bub { opacity: .75; border-color: var(--danger); }
.m-fail { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--danger); margin: 3px 2px 0; }
.m-fail button { border: 0; background: transparent; color: var(--text); font-weight: 650; font-size: 12px; text-decoration: underline; cursor: pointer; padding: 0; }
.m-act { width: 28px; height: 28px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--faint); display: grid; place-items: center; cursor: pointer; padding: 0; opacity: 0; flex: none; }
.m-act .ic { width: 16px; height: 16px; }
.m:hover .m-act, .m-act:focus-visible, .m-act[aria-expanded="true"] { opacity: 1; }
.m-act:hover, .m-act[aria-expanded="true"] { background: var(--raised); color: var(--text); }
@media (pointer: coarse) { .m-act { display: none; } }
.mg-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--faint); margin: 3px 3px 0; font-variant-numeric: tabular-nums; }
.mg-meta .ic { width: 13px; height: 13px; }
.mg-meta .ok { color: var(--ok); }

/* pictures inside a message */
.pics { display: grid; gap: 3px; border-radius: 10px; overflow: hidden; max-width: 100%; }
.mstack { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: 100%; }
.bub.withpics { padding: 4px; white-space: normal; max-width: 100%; }
.bub.withpics .pics { width: 100% !important; border-radius: 7px; }
.bub.withpics .cap { white-space: pre-wrap; overflow-wrap: anywhere; padding: 5px 8px 3px; }
.mg:not(.me) .bub.withpics { background: var(--theirs); }
.mg.me .mstack { align-items: flex-end; }
.pics.n1 { width: min(340px, 100%); }
.pics.n2 { grid-template-columns: 1fr 1fr; width: min(380px, 100%); }
.pics.n3 { grid-template-columns: 1fr 1fr; width: min(380px, 100%); }
.pics.n3 .pic:first-child { grid-row: span 2; }
.pics.n4 { grid-template-columns: 1fr 1fr; width: min(380px, 100%); }
.pic { position: relative; display: block; border: 0; padding: 0; margin: 0; background: var(--panel); cursor: zoom-in; overflow: hidden; min-height: 60px; }
.pics.n2 .pic, .pics.n4 .pic { aspect-ratio: 1; }
.pics.n3 .pic { aspect-ratio: 1; }
.pics.n3 .pic:first-child { aspect-ratio: auto; height: 100%; }
.pic img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .18s; }
.pic img.ready { opacity: 1; }
.pics.n1 .pic img { object-fit: contain; max-height: 420px; }
.pic .pic-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.pic .pic-ph .ic { width: 22px; height: 22px; }
.pic.hidden-pic, .pic.err { cursor: default; display: grid; place-items: center; text-align: center; padding: 14px; color: var(--faint); font-size: 12px; line-height: 1.35; border: 1px dashed var(--line-strong); background: var(--panel); aspect-ratio: auto !important; min-height: 110px; }
.pic.hidden-pic .ic, .pic.err .ic { width: 20px; height: 20px; margin: 0 auto 6px; display: block; }
.pic:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* new messages pill */
.jump { position: absolute; right: 22px; bottom: 96px; z-index: 6; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); font-weight: 700; font-size: 12.5px; padding: 7px 12px 7px 10px; border-radius: 18px; cursor: pointer; box-shadow: var(--shadow); }
.jump .ic { width: 15px; height: 15px; }
.jump.hot { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- composer ---------- */
.composer { flex: none; padding: 8px 18px 10px; background: var(--bg); border-top: 1px solid var(--line); }
.c-state { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 2px 4px 8px; }
.c-state .ic { width: 15px; height: 15px; color: var(--accent); }
.c-state.warn .ic { color: var(--warn); }
.c-state b { color: var(--text); }
.tray { display: flex; gap: 8px; padding: 2px 0 8px; overflow-x: auto; }
.tthumb { position: relative; width: 72px; height: 72px; flex: none; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line-strong); }
.tthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tthumb .t-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(12, 12, 13, .6); }
.tthumb .t-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: 0; border-radius: 4px; background: rgba(12, 12, 13, .82); color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0; }
.tthumb .t-x:hover { background: var(--danger); color: #160606; }
.tthumb .t-x .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.tthumb .t-size { position: absolute; left: 3px; bottom: 3px; font-size: 10px; font-weight: 700; background: rgba(12, 12, 13, .82); color: var(--muted); border-radius: 3px; padding: 0 4px; font-variant-numeric: tabular-nums; }
.tthumb.bad { border-color: var(--danger); }
.tthumb.bad .t-busy { background: rgba(58, 28, 26, .85); color: var(--danger); font-size: 10.5px; font-weight: 700; text-align: center; padding: 4px; line-height: 1.2; }
.tadd { width: 72px; height: 72px; flex: none; border-radius: var(--radius); border: 1px dashed var(--line-strong); background: transparent; color: var(--faint); display: grid; place-items: center; cursor: pointer; }
.tadd:hover { color: var(--text); border-color: var(--muted); }
.cbox { display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--line-strong); background: var(--panel); border-radius: var(--radius); padding: 5px 5px 5px 4px; }
.cbox:focus-within { border-color: var(--accent); }
.cbox.off { opacity: .55; }
.cbox .attach { width: 36px; height: 36px; }
.cbox textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: inherit; font-size: 15px; line-height: 1.45; padding: 7px 4px 7px 2px; max-height: 168px; min-height: 36px; }
.cbox textarea::placeholder { color: var(--faint); }
.sendbtn { width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.sendbtn .ic { stroke-width: 2.6; }
.sendbtn:hover { background: var(--accent-hover); }
.sendbtn:disabled { background: var(--raised); color: var(--faint); cursor: default; }
.c-foot { display: flex; align-items: center; gap: 10px; min-height: 18px; margin-top: 5px; padding: 0 4px; font-size: 11.5px; color: var(--faint); }
.c-err { color: var(--danger); font-weight: 600; }
.c-err:empty { display: none; }
.c-count { font-variant-numeric: tabular-nums; }
.c-count.over { color: var(--danger); font-weight: 700; }
.c-count:empty { display: none; }

/* drag and drop */
.drop { position: absolute; inset: 0; z-index: 20; background: rgba(12, 12, 13, .86); display: grid; place-items: center; padding: 20px; pointer-events: none; }
.drop-in { width: min(420px, 100%); border: 2px dashed var(--accent); border-radius: var(--radius); padding: 34px 20px; text-align: center; color: var(--text); background: var(--accent-soft); }
.drop-in .ic { width: 30px; height: 30px; color: var(--accent); margin: 0 auto 10px; display: block; }
.drop-in b { display: block; font-size: 16px; }
.drop-in small { color: var(--muted); font-size: 12.5px; }

/* ---------- menus ---------- */
.menu { position: fixed; z-index: 60; min-width: 200px; max-width: calc(100vw - 16px); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 5px; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--text); font-size: 13.5px; font-weight: 550; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; white-space: nowrap; }
.menu button .ic { width: 16px; height: 16px; color: var(--muted); }
.menu button:hover, .menu button:focus-visible { background: var(--raised); outline: 0; }
.menu button.danger { color: var(--danger); }
.menu button.danger .ic { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu .m-head { padding: 6px 10px 4px; font-size: 11px; font-weight: 750; letter-spacing: .8px; text-transform: uppercase; color: var(--faint); }

/* ---------- dialogs ---------- */
.dlg { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; }
.dlg-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); }
.dlg-card { position: relative; width: min(460px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.dlg-card.wide { width: min(540px, 100%); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); flex: none; }
.dlg-head h2 { margin: 0; font-size: 15.5px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-body { padding: 16px 18px; overflow-y: auto; min-height: 0; }
.dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.dlg-foot:empty { display: none; }
.dlg-foot .error-text { margin: 0 auto 0 0; }
.dlg-foot .left { margin-right: auto; }
.dlg p.note { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.dlg p.note b { color: var(--text); }
.dlg .f { margin: 0 0 14px; }
.dlg .count { float: right; font-weight: 600; color: var(--faint); letter-spacing: 0; text-transform: none; }
.searchbox { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--faint); }
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--muted); }
.searchbox .ic { width: 16px; height: 16px; }
.searchbox input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; color: var(--text); font-size: 14px; padding: 0; }
.searchbox input::placeholder { color: var(--faint); }
.results { margin: 8px -6px 0; min-height: 60px; }
.results .r-note { padding: 14px 6px; color: var(--faint); font-size: 13px; text-align: center; }
.urow { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; background: transparent; color: var(--text); border-radius: var(--radius-sm); text-align: left; cursor: pointer; }
.urow:hover:not(:disabled), .urow:focus-visible { background: var(--raised); outline: 0; }
.urow:disabled { cursor: default; opacity: .6; }
.urow .u-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.urow .u-names b { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.urow .u-names small { font-size: 12px; color: var(--faint); }
.urow .u-go { font-size: 12px; font-weight: 700; color: var(--muted); }
.urow .u-chk { width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--line-strong); display: grid; place-items: center; flex: none; color: transparent; }
.urow .u-chk .ic { width: 14px; height: 14px; stroke-width: 3; }
.urow.picked .u-chk { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chips:empty { display: none; }
.uchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border-radius: var(--radius-sm); background: var(--raised); border: 1px solid var(--line-strong); font-size: 12.5px; font-weight: 650; }
.uchip button { width: 18px; height: 18px; border: 0; background: transparent; color: var(--muted); border-radius: 3px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.uchip button:hover { background: var(--danger-soft); color: var(--danger); }
.uchip button .ic { width: 12px; height: 12px; stroke-width: 2.6; }
.members { margin: 4px -6px 0; }
.mrow { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: var(--radius-sm); }
.mrow:hover { background: var(--raised); }
.mrow .u-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.mrow .u-names b { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .u-names small { font-size: 12px; color: var(--faint); }
.rtag { font-size: 10.5px; font-weight: 750; letter-spacing: .5px; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line-strong); color: var(--muted); flex: none; }
.rtag.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rtag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.reasons { display: grid; gap: 6px; margin: 0 0 14px; }
.reason { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--bg); }
.reason:hover { border-color: var(--muted); }
.reason input { margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.reason b { display: block; font-size: 13.5px; font-weight: 650; }
.reason small { display: block; color: var(--faint); font-size: 12px; line-height: 1.35; }
.reason:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.checkline { display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; margin: 4px 0 0; }
.checkline input { accent-color: var(--accent); margin: 0; }
.quote { border-left: 3px solid var(--line-strong); padding: 6px 10px; margin: 0 0 14px; background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 92px; overflow: hidden; }
.quote b { color: var(--text); }
.dzone { margin: 18px 0 0; padding: 12px; border: 1px solid #4a2320; border-radius: var(--radius); }
.dzone h3 { margin: 0 0 4px; font-size: 11px; font-weight: 750; letter-spacing: 1.2px; text-transform: uppercase; color: var(--danger); }
.dzone p { margin: 0 0 10px; font-size: 12.5px; color: var(--faint); }
.dzone .row { flex-wrap: wrap; gap: 8px; }
.btn.dangerfill { background: var(--danger); border-color: var(--danger); color: #160606; }
.btn.dangerfill:hover { background: #ff776e; border-color: #ff776e; }
.btn .ic { width: 15px; height: 15px; }
.inline-row { display: flex; gap: 8px; }
.inline-row .field { flex: 1; min-width: 0; }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 80; background: rgba(6, 6, 7, .96); display: flex; flex-direction: column; }
.lb-top { height: 56px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px 0 18px; color: var(--text); }
.lb-top .icon { color: var(--muted); }
.lb-top .icon:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.lb-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.lb-who b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-who small { font-size: 12px; color: var(--faint); }
.lb-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; }
.lb-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 64px 24px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; user-select: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 1px solid var(--line-strong); background: rgba(20, 20, 22, .9); color: var(--text); border-radius: 22px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.lb-nav:hover { background: var(--raised); }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-nav[hidden] { display: none; }

/* ---------- phone: list and thread are two screens ---------- */
@media (max-width: 760px) {
  :root { --lp-w: 100%; }
  .mapp { grid-template-columns: 100%; }
  .mapp .tp { display: none; }
  .mapp.show-thread .lp { display: none; }
  .mapp.show-thread .tp { display: flex; }
  .lp { border-right: 0; }
  .th-top .back { display: grid; }
  .th-top { padding: 0 6px 0 10px; gap: 2px; }
  .th-list { padding: 14px 12px 8px; }
  .mg-body { max-width: 82%; }
  .mg .av { display: none; }
  .composer { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .c-hint { display: none; }
  .c-foot:not(:has(.c-err:not(:empty))):not(:has(.c-count:not(:empty))) { display: none; }
  .jump { right: 12px; bottom: 84px; }
  .th-notice { padding: 10px 12px; }
  .lb-stage { padding: 0 8px 16px; }
  .lb-nav { width: 40px; height: 40px; }
  .lb-nav.prev { left: 6px; } .lb-nav.next { right: 6px; }
  .te-tips li { grid-template-columns: 80px 1fr; }
  .dlg { padding: 0; place-items: end center; }
  .dlg-card, .dlg-card.wide { width: 100%; max-height: 92dvh; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
  .dlg-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .lp-foot { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .lp-top { padding: 0 6px 0 10px; }
  .lp-title { font-size: 24px; }
  .newchat span { display: none; }
  .newchat { padding: 6px 8px; }
  .lp-foot .li-user > span:last-child { display: none; }
  .tp-empty h2 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) { .pic img { transition: none; } .spin { animation-duration: 2s; } }

/* toasts sit at the top here, clear of the composer and dialog buttons */
#li-toast { top: 66px; bottom: auto; transform: translate(-50%, -8px); z-index: 90; }
#li-toast.show { transform: translate(-50%, 0); }
.searchbox input::-webkit-search-cancel-button { filter: invert(.6); cursor: pointer; }
/* the report dialog: reasons in two columns where there is room */
.dlg-card.wide .reasons { grid-template-columns: 1fr 1fr; }
.dlg-card.wide .reasons .reason:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 760px) { .dlg-card.wide .reasons { grid-template-columns: 1fr; } #li-toast { top: 64px; max-width: calc(100vw - 32px); } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
