/* ==========================================================
   Ephemeral — components added on top of the shared kit (app.css)
   ========================================================== */

/* ---------- Small kit extras ---------- */
.avatar-in { display: grid; place-items: center; width: 100%; height: 100%; }
.avatar-in img { width: 100%; height: 100%; object-fit: cover; }
span.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; overflow: hidden;
  background: var(--primary); color: var(--on-primary); font-weight: 700; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: default; }
span.avatar img { width: 100%; height: 100%; object-fit: cover; }
span.avatar.is-group { border-radius: 13px; background: var(--accent); color: #fff; }
.avatar-xl { width: 76px !important; height: 76px !important; font-size: 1.8rem; }
.avatar-sm { width: 30px !important; height: 30px !important; font-size: .78rem; }
.nav-toggle { position: relative; }
.nav-toggle .dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font: 700 .72rem/20px var(--font); text-align: center; }
.mainnav-link .nav-count { margin-left: 2px; }
.drawer-user { display: flex; align-items: center; gap: 12px; padding: 6px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.drawer-user span:last-child { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.drawer-user small { overflow: hidden; text-overflow: ellipsis; }
.brand-mark { font-family: var(--font-display); }
@media (min-width: 900px) { .mainnav { display: flex; } .nav-toggle { display: none !important; } }
.pop button.pop-item span, .pop a span { flex: 1; }
.empty .ico { display: block; margin: 0 auto 8px; }
.empty p { margin-bottom: 14px; }

/* Avatar picker */
.avatar-picker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.avatar-picker .hint { flex-basis: 100%; }

/* People rows (friends, members, requests) */
.people { display: flex; flex-direction: column; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.person-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.person.is-check { cursor: pointer; border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.person.is-check:hover { background: var(--surface-2); }
.person.is-check:has(input:checked) { background: var(--mark-soft); }
.role { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.role .ico { width: 13px; height: 13px; }
.role-2 { background: var(--mark-soft); color: var(--ink); }
.role-1 { background: var(--info-soft); color: var(--ink); }
.count-pill { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); background: var(--surface-2); padding: 1px 8px; border-radius: 99px; margin-left: 6px; }
.seg .count:empty { display: none; }

/* Group cards */
.group-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .group-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1020px) { .group-grid { grid-template-columns: repeat(3, 1fr); } }
.gcard { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.gcard-top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.gcard-top > div { min-width: 0; }
.gcard h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-faces { display: flex; align-items: center; }
.gcard-faces .avatar { width: 30px; height: 30px; font-size: .74rem; margin-right: -8px; }
.gcard-faces .more { margin-left: 14px; font-size: .8rem; color: var(--muted); font-weight: 700; }
.gcard-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.gcard-actions .btn { flex: 1; }
.gcard.is-new { border-style: dashed; border-width: 1.5px; box-shadow: none; background: transparent; align-items: center; justify-content: center; text-align: center; min-height: 170px; text-decoration: none; color: var(--ink-2); }
.gcard.is-new:hover { background: var(--mark-soft); border-color: var(--primary); }
.gcard.is-new .tile-icon { margin: 0 auto; }
.tabs-bar { margin-bottom: 18px; overflow-x: auto; max-width: 100%; }

/* Search results (add friend) */
.results { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.results:empty { display: none; }
.results .person { padding: 10px 14px; }
.results .muted { padding: 14px; margin: 0; }

/* Info dialog */
.info-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.info-head > div { flex: 1; min-width: 0; }
.info-head h3 { font-family: var(--font-display); font-size: 1.35rem; }
.info-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 18px; font-size: .92rem; }
.info-dl dt { color: var(--muted); font-weight: 600; }
.info-dl dd { margin: 0; }
.member-list { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; margin: 0 -6px; }
.member { display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-radius: 10px; text-decoration: none; color: inherit; }
a.member:hover { background: var(--surface-2); }
.member > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.member small { color: var(--muted); }

/* ==========================================================
   CHAT APP
   ========================================================== */
.page-chat { --side-w: 360px; }
.page-chat .main-app { flex: 1; display: flex; min-height: 0; }
.main-app { width: 100%; }
.page-chat { height: var(--app-h, 100dvh); min-height: 0; overflow: hidden; }
.page-chat .flash-stack { position: fixed; top: calc(var(--topbar-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 70; width: min(92vw, 520px); }
.chat-app { flex: 1; display: grid; grid-template-columns: 1fr; min-height: 0; max-width: 1400px; margin: 0 auto; width: 100%; }
@media (min-width: 900px) {
  .chat-app { grid-template-columns: var(--side-w) minmax(0, 1fr); padding: 14px 16px 16px; gap: 14px; }
  .chat-side, .chat-main { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
}
@media (min-width: 1200px) { .page-chat { --side-w: 390px; } }
@media (max-width: 899.98px) {
  .chat-app[data-view="list"] .chat-main { display: none; }
  .chat-app[data-view="conv"] .chat-side { display: none; }
  body.page-chat.in-conv .topbar { display: none; }
}

/* ---------- side ---------- */
.chat-side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--surface); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 8px; }
.side-title { font-size: 1.55rem; }
.side-tools { padding: 4px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.side-filter { align-self: flex-start; }
.side-filter .count { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 6px; font-size: .7rem; }
.side-requests { display: flex; align-items: center; gap: 10px; margin: 0 12px 8px; padding: 10px 12px; border-radius: 12px; background: var(--mark-soft); text-decoration: none; font-weight: 700; font-size: .9rem; }
.side-requests span { flex: 1; }
.chat-list { list-style: none; margin: 0; padding: 0 8px 12px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.chat-item { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 14px; text-decoration: none; color: inherit; position: relative; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.is-active { background: var(--mark-soft); }
.chat-item .avatar { width: 48px; height: 48px; font-size: 1.05rem; }
.ci-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ci-top, .ci-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ci-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .98rem; }
.ci-kind .ico { width: 14px; height: 14px; color: var(--muted); }
.ci-top time { font-size: .74rem; color: var(--muted); white-space: nowrap; font-family: var(--font-mono); }
.ci-prev { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; overflow: hidden; white-space: nowrap; color: var(--muted); font-size: .88rem; }
.ci-prev span, .ci-prev em { overflow: hidden; text-overflow: ellipsis; }
.ci-prev b { color: var(--ink-2); font-weight: 600; flex: none; }
.ci-prev .ico { width: 14px; height: 14px; flex: none; color: var(--success); }
.ci-muted .ico { width: 15px; height: 15px; color: var(--muted); }
.ci-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: #fff; font: 700 .74rem/22px var(--font); text-align: center; }
.chat-item.has-unread .ci-top strong { font-weight: 800; }
.chat-item.has-unread .ci-top time { color: var(--accent); font-weight: 700; }
.chat-item.has-unread .ci-prev { color: var(--ink-2); }
.chat-item.is-blocked { opacity: .6; }
.chat-item.is-skeleton .avatar { background: var(--surface-3); box-shadow: none; }
.chat-item.is-skeleton .ci-text span { display: block; height: 11px; border-radius: 6px; background: var(--surface-3); width: 60%; }
.chat-item.is-skeleton .ci-text span + span { width: 85%; opacity: .6; }
.chat-item.is-skeleton { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.list-error { padding: 20px; color: var(--danger); font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.side-empty { padding: 30px 20px; }

/* ---------- main ---------- */
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; position: relative; background: var(--paper); }
@media (min-width: 900px) { .chat-main { background: var(--paper); } }
.chat-placeholder { margin: auto; text-align: center; padding: 30px; max-width: 440px; }
.chat-placeholder h2 { font-size: 1.6rem; margin: 18px 0 8px; }
.ph-art { position: relative; width: 140px; height: 110px; margin: 0 auto; }
.ph-bubble { position: absolute; border-radius: 22px; }
.ph-bubble.a { left: 0; top: 0; width: 96px; height: 62px; background: var(--surface-3); border-bottom-left-radius: 6px; }
.ph-bubble.b { right: 0; bottom: 0; width: 96px; height: 62px; background: var(--mark); border-bottom-right-radius: 6px; display: grid; place-items: center; color: #1a1d26; transform: rotate(-4deg); }
.ph-bubble.b .ico { width: 26px; height: 26px; }
.ph-tips { list-style: none; padding: 0; margin: 22px 0 0; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.ph-tips li { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); padding: 10px 12px; border-radius: 12px; }
.ph-tips .ico { color: var(--accent); margin-top: 2px; }
@media (max-width: 899.98px) { .chat-placeholder { display: none; } }

.conv { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.conv[hidden] { display: none; }
.conv-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface); padding-top: max(8px, env(safe-area-inset-top)); }
.conv-back { flex: none; }
@media (min-width: 900px) { .conv-back { display: none; } }
.conv-who { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; padding: 4px 8px 4px 4px; border: 0; background: none; border-radius: 12px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.conv-who:hover { background: var(--surface-2); }
.conv-who .avatar { width: 42px; height: 42px; cursor: pointer; }
.conv-who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.conv-who-text strong { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-who-text small { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.enc-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; background: var(--success-soft); color: var(--success); font-weight: 700; font-size: .76rem; white-space: nowrap; }
.enc-chip .ico { width: 14px; height: 14px; }
.enc-chip.is-locked { background: var(--mark-soft); color: var(--ink); }
@media (max-width: 420px) { .enc-chip span { display: none; } }
.conv-search { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.conv-search .input-icon { flex: 1; }
.conv-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--danger-soft); color: var(--danger); font-weight: 600; font-size: .9rem; }
.conv-banner span { flex: 1; }

.conv-scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 10px 14px 16px; overscroll-behavior: contain;
  background-image: radial-gradient(circle at 1px 1px, rgba(120, 100, 60, .07) 1px, transparent 0); background-size: 22px 22px; }
@media (min-width: 900px) { .conv-scroll { padding: 14px 6% 18px; } }
.older-wrap { text-align: center; padding: 6px 0 10px; }
.msgs { display: flex; flex-direction: column; gap: 3px; }
.msgs-loading, .msgs-empty { display: grid; place-items: center; padding: 60px 20px; color: var(--muted); text-align: center; }
.msgs-empty .ico { width: 40px; height: 40px; color: var(--line-2); }
.day-sep, .unread-sep { display: flex; justify-content: center; margin: 14px 0 8px; position: sticky; top: 0; z-index: 2; }
.day-sep span { background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); padding: 3px 12px; border-radius: 99px; font-size: .74rem; font-weight: 700; color: var(--ink-2); backdrop-filter: blur(6px); display: inline-block; }
.day-sep span::first-letter { text-transform: uppercase; }
.unread-sep { position: static; }
.unread-sep span { background: var(--mark-soft); color: var(--ink); padding: 3px 14px; border-radius: 99px; font-size: .76rem; font-weight: 700; }

.msg { display: flex; align-items: flex-end; gap: 8px; max-width: min(78%, 640px); position: relative; margin-top: 8px; }
.msg.is-cont { margin-top: 0; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.theirs { align-self: flex-start; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--primary); color: var(--on-primary); font-size: .74rem; font-weight: 700; }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-avatar.is-empty { background: none; }
.bubble { position: relative; padding: 8px 12px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 0 rgba(24, 34, 58, .04); min-width: 70px; overflow-wrap: anywhere; word-break: break-word; }
.msg.theirs .bubble { border-bottom-left-radius: 6px; }
.msg.mine .bubble { background: var(--primary); color: var(--on-primary); border-color: transparent; border-bottom-right-radius: 6px; }
.msg.is-cont.theirs .bubble { border-top-left-radius: 6px; }
.msg.is-cont.mine .bubble { border-top-right-radius: 6px; }
:root[data-theme="dark"] .msg.mine .bubble { background: #2c3a63; color: #f3efe6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.mine .bubble { background: #2c3a63; color: #f3efe6; } }
.msg-author { font-size: .78rem; font-weight: 800; margin-bottom: 2px; color: var(--gc, var(--accent)); }
.msg-body { font-size: .97rem; line-height: 1.45; }
.msg-body p, .msg-body div { margin: 0; }
.msg-body ul, .msg-body ol { margin: 4px 0; padding-left: 20px; }
.msg-body mark.hit { background: var(--mark); color: #1a1d26; border-radius: 3px; padding: 0 1px; }
.msg-body mark.hit.is-current { outline: 2px solid var(--accent); }
.msg.mine .msg-body font[color="#18223a"], .msg.mine .msg-body [style*="color: rgb(24, 34, 58)"] { color: inherit !important; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; font-size: .68rem; opacity: .7; font-family: var(--font-mono); }
.msg-meta .ico { width: 13px; height: 13px; }
.ticks.is-read { color: var(--mark); opacity: 1; }
.msg.theirs .ticks.is-read { color: var(--success); }
.msg-lock { color: inherit; }
.msg.is-enc .bubble { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success) 40%, transparent); }
.msg.mine.is-enc .bubble { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--mark) 70%, transparent); }
.was-enc { animation: unveil .4s ease; }
@keyframes unveil { from { filter: blur(4px); opacity: .3; } }
.enc-locked { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1px dashed currentColor; border-radius: 10px; background: transparent; color: inherit; padding: 7px 10px; cursor: pointer; font: 600 .88rem var(--font); text-align: left; opacity: .9; }
.enc-locked .ico { width: 16px; height: 16px; }
.enc-locked small { flex-basis: 100%; font-size: .74rem; color: inherit; opacity: .75; }
.enc-locked.is-wrong { border-style: solid; }
.msg-act { opacity: 0; align-self: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; box-shadow: 0 0 0 1px var(--line); transition: opacity .15s; flex: none; }
.msg-act .ico { width: 15px; height: 15px; }
.msg-act:hover { color: var(--danger); }
.msg:hover .msg-act, .msg-act:focus-visible { opacity: 1; }
@media (pointer: coarse) { .msg-act { opacity: .55; width: 28px; height: 28px; } }

.jump-down { position: absolute; right: 16px; bottom: 96px; z-index: 5; display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-lg); cursor: pointer; font: 700 .82rem var(--font); color: var(--ink); }
.jump-down .ico { transform: rotate(90deg); width: 18px; height: 18px; }
.jump-down span:empty { display: none; }

/* ---------- composer ---------- */
.composer { border-top: 1px solid var(--line); background: var(--surface); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.composer[hidden] { display: none; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer-input { flex: 1; min-height: 44px; max-height: 38vh; overflow-y: auto; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line-2); background: var(--paper); font-size: 1rem; line-height: 1.4; outline: none; overflow-wrap: anywhere; }
.composer-input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mark) 35%, transparent); }
.composer-input:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.composer-input p, .composer-input div { margin: 0; }
.composer .btn-icon { width: 44px; height: 44px; flex: none; border-radius: 50%; }
.send-btn { width: 48px; min-height: 48px; height: 48px; padding: 0; border-radius: 50%; flex: none; }
.send-btn .ico { width: 20px; height: 20px; }
.enc-toggle .only-on { display: none; }
.enc-toggle.is-on { background: var(--success-soft); color: var(--success); }
.enc-toggle.is-on .only-on { display: inline; } .enc-toggle.is-on .only-off { display: none; }
[data-fmt-toggle][aria-pressed="true"] { background: var(--mark-soft); color: var(--ink); }
.composer-hint { margin: 4px 0 0 52px; font-size: .72rem; color: var(--muted); }
.composer-hint kbd { font-size: .9em; }
.fmt-bar { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; padding: 0 0 8px; }
.fmt-btn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; font: 700 .9rem var(--font-display); }
.fmt-btn:hover { background: var(--surface-2); color: var(--ink); }
.fmt-btn .ico { width: 17px; height: 17px; }
.fmt-size[data-size="2"] { font-size: .72rem; } .fmt-size[data-size="5"] { font-size: 1.15rem; }
.fmt-sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 5px; }
.fmt-label { display: inline-grid; place-items: center; width: 22px; color: var(--muted); }
.fmt-label .ico { width: 16px; height: 16px; }
.fmt-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); background: var(--sw); cursor: pointer; margin: 0 2px; }
.fmt-swatch:hover { transform: scale(1.12); }

/* Key dialog */
.key-note { margin: 4px 0 12px; font-weight: 500; font-size: .86rem; }
.modal h2 { font-size: 1.25rem; }

/* ---------- history (chat_management) ---------- */
.range-grid { display: grid; gap: 0 14px; grid-template-columns: 1fr 1fr; }
.preview-box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); max-height: 340px; overflow-y: auto; padding: 10px 14px; }
.preview-line { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.preview-line:last-child { border-bottom: 0; }
.preview-line b { font-weight: 700; }
.preview-line time { color: var(--muted); font-family: var(--font-mono); font-size: .78rem; margin-right: 6px; }

/* ---------- help ---------- */
.feature-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature .tile-icon { flex: none; }
.feature h3 { margin-bottom: 4px; }
.feature p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-left: 38px !important; margin-bottom: 10px !important; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 8px; background: var(--mark); color: #1a1d26; font: 700 .85rem/26px var(--font); text-align: center; }

/* layout fixes */
.grid-main-side { align-items: start; }
.form-actions form { display: inline-flex; }
@media (max-width: 560px) {
  .tabs-bar { display: flex; width: 100%; }
  .tabs-bar a { flex: 1; justify-content: center; padding: 7px 6px; }
  .tabs-bar a .ico { display: none; }
  .page-head .page-actions .btn { width: 100%; }
  .page-actions { width: 100%; }
}
.avatar-picker .avatar.is-group { border-radius: 20px; }
.empty .btn .ico { width: 18px; height: 18px; margin: 0; display: inline-block; color: inherit; }

/* logo */
.brand-mark.brand-logo { background: none; box-shadow: none; transform: none; border-radius: 50%; overflow: hidden; padding: 0; }
.brand-logo img { width: 100%; height: 100%; display: block; }
.auth-logo { width: 150px; height: 150px; border-radius: 50%; margin: 48px 0 0; box-shadow: 0 20px 50px -20px rgba(0,0,0,.6); position: relative; z-index: 1; }
.auth-done .done-icon { overflow: hidden; }
/* welcome card */
.welcome { display: flex; gap: 12px; margin: 0 12px 10px; padding: 14px; border-radius: 14px; background: var(--mark-soft); align-items: flex-start; }
.welcome img { border-radius: 50%; flex: none; }
.welcome strong { display: block; margin-bottom: 2px; }
.welcome p { margin: 0 0 10px; font-size: .86rem; color: var(--ink-2); }
/* help hero */
.help-hero { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.help-hero img { width: 120px; height: 120px; border-radius: 50%; flex: none; box-shadow: var(--shadow); }
.help-hero > div { flex: 1; min-width: 240px; }
.how-steps { display: grid; gap: 12px; grid-template-columns: 1fr; counter-reset: hs; margin-top: 18px; }
@media (min-width: 700px) { .how-steps { grid-template-columns: repeat(4, 1fr); } }
.how-step { position: relative; padding: 16px 14px 14px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); counter-increment: hs; }
.how-step::before { content: counter(hs); position: absolute; top: -10px; left: 14px; width: 24px; height: 24px; border-radius: 8px; background: var(--mark); color: #1a1d26; font: 700 .8rem/24px var(--font); text-align: center; }
.how-step .ico { color: var(--accent); width: 22px; height: 22px; margin-bottom: 6px; }
.how-step strong { display: block; margin-bottom: 3px; }
.how-step p { margin: 0; font-size: .86rem; color: var(--ink-2); }

/* dictation */
.mic-btn.is-on { background: var(--danger-soft); color: var(--danger); animation: micpulse 1.3s ease-in-out infinite; }
@keyframes micpulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 45%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--danger) 0%, transparent); } }
.dict-interim { color: var(--muted); }
@media (max-width: 380px) { .composer .btn-icon { width: 40px; height: 40px; } .send-btn { width: 44px; height: 44px; min-height: 44px; } }

/* composer on phones: text box full width + send; tools in a second row, aligned left */
@media (max-width: 639.98px) {
  .composer-row { display: grid; grid-template-columns: auto auto auto 1fr auto; grid-template-areas: "input input input input send" "fmt mic enc . ."; gap: 6px 4px; align-items: end; }
  .composer-row [data-input] { grid-area: input; }
  .composer-row [data-send] { grid-area: send; margin-left: 2px; }
  .composer-row [data-fmt-toggle] { grid-area: fmt; }
  .composer-row [data-mic] { grid-area: mic; }
  .composer-row [data-enc-toggle] { grid-area: enc; }
  .composer-row .btn-icon { width: 38px; height: 34px; border-radius: 10px; }
  .composer-row .btn-icon .ico { width: 19px; height: 19px; }
  .composer-input { max-height: 30vh; }
  .composer { padding-top: 8px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
}

/* sent messages: light blue with dark text (dark theme: muted blue with light text) */
:root { --mine-bg: #d6e6ff; --mine-ink: #10182b; --mine-line: #b9d1f7; --mine-tick: #1f63d6; }
:root[data-theme="dark"] { --mine-bg: #2d4a7a; --mine-ink: #f1f4fa; --mine-line: transparent; --mine-tick: #8fc2ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --mine-bg: #2d4a7a; --mine-ink: #f1f4fa; --mine-line: transparent; --mine-tick: #8fc2ff; } }
.msg.mine .bubble,
:root[data-theme="dark"] .msg.mine .bubble { background: var(--mine-bg); color: var(--mine-ink); border-color: var(--mine-line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.mine .bubble { background: var(--mine-bg); color: var(--mine-ink); } }
.msg.mine .msg-meta { opacity: .75; }
.msg.mine .ticks.is-read { color: var(--mine-tick); opacity: 1; }
.msg.mine.is-enc .bubble { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--success) 55%, transparent); }

/* photo viewer (tap a friend's or group's picture) */
[data-zoom] { cursor: zoom-in; }
.zoom-view { position: fixed; inset: 0; margin: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(10, 13, 20, .88); backdrop-filter: blur(6px); padding: 24px; cursor: zoom-out; animation: zoomin .18s ease; }
.zoom-view img { max-width: min(92vw, 560px); max-height: 74vh; width: auto; height: auto; border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); background: #fff; }
.zoom-view figcaption { color: #fff; font-weight: 700; font-size: 1.05rem; text-align: center; }
.zoom-view figcaption small { display: block; font-weight: 500; opacity: .7; font-size: .85rem; }
.zoom-view .btn-icon { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; color: #fff; background: rgba(255,255,255,.12); }
@keyframes zoomin { from { opacity: 0; } }
