/* ═══════════════════════════════════════════════════════════════
   Styles for js/features/* — polls, pins, disappearing & view-once
   messages, AI tools, security, quick replies, broadcasts, business
   profile, effects and the two extra live games. Built only from the
   theme tokens in theme.css, so every palette and light/dark works.
   ═══════════════════════════════════════════════════════════════ */

/* Bubbles already on screen don't replay the pop-in animation when the
   list re-renders (votes, ticks, reactions) — see renderMessages. */
.bubble.seen { animation: none !important; }

/* ── Shared building blocks ─────────────────────────────────── */

.modal-title-icon { width: 20px; height: 20px; vertical-align: -4px; margin-right: 4px; color: var(--accent); }

.feature-card { width: min(480px, calc(100vw - 32px)); }

.feature-hero { text-align: center; margin-bottom: 18px; }
.feature-hero h3 { margin: 10px 0 6px; }
.feature-hero p { margin: 0 auto; max-width: 380px; color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }
.feature-hero-icon {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 18px;
  display: grid; place-items: center;
  background: rgba(var(--accent-2-rgb), 0.16);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-2-rgb), 0.28);
}
.feature-hero-icon svg { width: 27px; height: 27px; }
.feature-hero-icon.ai { background: var(--grad-accent); color: var(--on-accent); box-shadow: 0 10px 28px rgba(var(--accent-2-rgb), 0.35); }

.feature-sub { margin: -6px 0 14px; color: var(--text-dim); font-size: 13px; }

.feature-footnote {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 14px 0 0; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--hover-bg-soft); color: var(--text-dim); font-size: 12px; line-height: 1.45;
}
.feature-footnote svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--accent); }

/* Selectable rows (radio list / action list) */
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 14px; border-radius: var(--r-md);
  background: var(--hover-bg-soft); border: 1px solid var(--border);
  color: var(--text); text-align: left; cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.choice-row:hover:not(:disabled) { background: var(--hover-bg); border-color: var(--border-lit); }
.choice-row:active:not(:disabled) { transform: scale(0.99); }
.choice-row:disabled { opacity: .6; cursor: default; }
.choice-row.selected { border-color: var(--border-lit); background: rgba(var(--accent-2-rgb), 0.12); }
.choice-radio {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid var(--muted); position: relative; transition: border-color .15s;
}
.choice-row.selected .choice-radio { border-color: var(--accent); }
.choice-row.selected .choice-radio::after {
  content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent);
}
.choice-label { font-weight: 650; font-size: 14px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-sub { font-size: 12px; color: var(--text-dim); }
.choice-emoji { font-size: 22px; width: 30px; text-align: center; flex: none; }

/* Toggle rows + switch */
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 14px; border-radius: var(--r-md); width: 100%;
  background: var(--hover-bg-soft); border: 1px solid var(--border);
  cursor: pointer; color: var(--text); text-align: left; margin-bottom: 8px;
}
.settings-list .toggle-row { margin-bottom: 0; }
/* Inside a form .field, beat the generic "label: display block" rule. */
.modal-card .field > label.toggle-row {
  display: flex; font-size: inherit; font-weight: inherit; color: var(--text);
  letter-spacing: 0; margin-bottom: 12px;
}
.toggle-row.as-button:hover { background: var(--hover-bg); }
.toggle-row > span:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.toggle-title { font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.toggle-title svg { width: 16px; height: 16px; color: var(--accent); }
.toggle-sub { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.settings-value { color: var(--accent); font-weight: 650; font-size: 13px; white-space: nowrap; }

/* Specific enough to beat the generic ".modal-card .field input" text-box
   styling (full width, padding, inset background) for switches in forms. */
input.switch,
.field input.switch,
.modal-card .field input.switch {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 44px; height: 26px; border-radius: 99px; margin: 0; padding: 0;
  border: none; box-shadow: none;
  background: var(--hover-bg-strong); position: relative; cursor: pointer;
  transition: background .2s;
}
.modal-card .field input.switch:focus { background: var(--hover-bg-strong); box-shadow: none; }
.modal-card .field input.switch:checked,
.modal-card .field input.switch:checked:focus { background: var(--grad-accent); }
.modal-card .field input.switch.small { width: 38px; height: 22px; }
input.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}
input.switch:checked, .field input.switch:checked { background: var(--grad-accent); }
input.switch:checked::after { transform: translateX(18px); }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input.switch.small { width: 38px; height: 22px; }
input.switch.small::after { width: 16px; height: 16px; }
input.switch.small:checked::after { transform: translateX(16px); }

.btn-danger {
  padding: 10px 16px; border-radius: var(--r-sm); border: none; cursor: pointer;
  background: var(--danger); color: #fff; font-weight: 650; font-size: 13px; white-space: nowrap;
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger:disabled { opacity: .6; cursor: default; }

.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-bg); }

.modal-actions .btn-primary svg, .modal-actions .btn-secondary svg,
.bc-send svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; }

kbd {
  font: 600 11px/1 var(--font); padding: 2px 6px; border-radius: 5px;
  background: var(--hover-bg-strong); border: 1px solid var(--border);
}

/* Loading dots / results */
.ai-loading { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 22px 0; color: var(--text-dim); font-size: 13px; }
.ai-loading span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: ai-dot 1.1s infinite ease-in-out; }
.ai-loading span:nth-child(2) { animation-delay: .15s; }
.ai-loading span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes ai-dot { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

.ai-result { min-height: 60px; }
.ai-points { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ai-points li {
  position: relative; padding: 10px 12px 10px 34px; border-radius: var(--r-sm);
  background: var(--hover-bg-soft); border: 1px solid var(--border); font-size: 13.5px; line-height: 1.5;
}
.ai-points li::before {
  content: ''; position: absolute; left: 14px; top: 17px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--grad-accent);
}
.ai-meta { margin-top: 10px; font-size: 11.5px; color: var(--muted); text-align: right; }
.ai-error, .ai-empty {
  display: flex; gap: 8px; align-items: flex-start; padding: 14px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.45;
}
.ai-error { background: var(--danger-bg); color: var(--danger-text); }
.ai-error svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.ai-empty { justify-content: center; color: var(--text-dim); background: var(--hover-bg-soft); text-align: center; }

.export-progress {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(var(--accent-2-rgb), 0.1); color: var(--text); font-size: 13px; text-align: center;
}

/* ── Polls ─────────────────────────────────────────────────── */

.bubble.is-poll { min-width: min(320px, 72vw); }
.poll-card { display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.poll-head {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; opacity: .75;
}
.poll-head svg { width: 14px; height: 14px; }
.poll-question { font-weight: 700; font-size: 15.5px; line-height: 1.35; }
.poll-hint { font-size: 11.5px; opacity: .7; margin-bottom: 4px; }
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-option {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 12px; border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.14); color: inherit; text-align: left; cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
}
.bubble.them .poll-option { background: var(--hover-bg-soft); }
.poll-option:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
.bubble.them .poll-option:hover:not(:disabled) { background: var(--hover-bg); }
.poll-option:active:not(:disabled) { transform: scale(0.985); }
.poll-option.chosen { border-color: rgba(255, 255, 255, 0.55); }
.bubble.them .poll-option.chosen { border-color: var(--border-lit); }
.poll-check {
  width: 19px; height: 19px; flex: none; margin-top: 1px; border-radius: 50%;
  border: 2px solid currentColor; opacity: .7; display: grid; place-items: center;
}
.poll-check.square { border-radius: 6px; }
.poll-option.chosen .poll-check { opacity: 1; background: currentColor; }
.poll-check svg { width: 12px; height: 12px; stroke-width: 3.2; color: var(--bubble-me); }
.bubble.them .poll-option.chosen .poll-check { background: var(--accent); border-color: var(--accent); }
.bubble.them .poll-check svg { color: var(--on-accent); }
.poll-option-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.poll-option-row { display: flex; justify-content: space-between; gap: 10px; }
.poll-option-text { font-size: 14px; line-height: 1.35; word-break: break-word; }
.poll-option-count { font-size: 12.5px; font-weight: 700; opacity: .85; }
.poll-bar { height: 5px; border-radius: 99px; background: rgba(0, 0, 0, 0.18); overflow: hidden; }
.bubble.them .poll-bar { background: var(--hover-bg-strong); }
.poll-bar i { display: block; height: 100%; border-radius: inherit; background: rgba(255, 255, 255, 0.85); transition: width .45s cubic-bezier(.2, .9, .3, 1); }
.bubble.them .poll-bar i { background: var(--grad-accent); }
.poll-option.leading .poll-option-count { opacity: 1; }
.poll-footer {
  margin-top: 4px; padding: 8px; border: none; border-top: 1px solid rgba(255, 255, 255, 0.18);
  background: none; color: inherit; font-weight: 650; font-size: 12.5px; cursor: pointer; border-radius: 0 0 8px 8px;
}
.bubble.them .poll-footer { border-top-color: var(--border); color: var(--accent); }
.poll-footer:disabled { cursor: default; opacity: .65; color: inherit; }
.poll-footer:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }

.poll-composer .field { margin-bottom: 14px; }
.poll-edit-options { display: flex; flex-direction: column; gap: 8px; }
.poll-edit-option { display: flex; align-items: center; gap: 8px; }
.poll-edit-option input { flex: 1; }
.poll-edit-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.poll-edit-option .icon-btn { width: 32px; height: 32px; flex: none; }
.poll-edit-option .icon-btn svg { width: 15px; height: 15px; }
.poll-add-option {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--r-sm); border: 1px dashed var(--border-lit);
  background: none; color: var(--accent); font-weight: 650; font-size: 13px; cursor: pointer;
}
.poll-add-option svg { width: 15px; height: 15px; }
.poll-add-option:disabled { opacity: .45; cursor: default; }

.poll-results-q { font-weight: 700; font-size: 15px; margin: -4px 0 14px; }
.poll-results { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }
.poll-result { padding: 12px; border-radius: var(--r-sm); background: var(--hover-bg-soft); border: 1px solid var(--border); }
.poll-result-head { display: flex; justify-content: space-between; gap: 10px; font-weight: 650; font-size: 14px; }
.poll-result-n { color: var(--accent); font-size: 12.5px; white-space: nowrap; }
.poll-result-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.poll-person { padding: 3px 10px; border-radius: 99px; background: rgba(var(--accent-2-rgb), 0.14); font-size: 12px; }
.poll-result-none { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ── Pinned message ────────────────────────────────────────── */

.pinned-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px 9px 18px; cursor: pointer;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: relative; z-index: 2;
  animation: pinned-in .25s ease;
}
.pinned-bar::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--grad-accent);
}
.pinned-bar:hover { background: var(--hover-bg); }
@keyframes pinned-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pinned-bar-icon { color: var(--accent); display: grid; }
.pinned-bar-icon svg { width: 17px; height: 17px; }
.pinned-bar-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pinned-bar-label { font-size: 11.5px; font-weight: 700; color: var(--accent); }
.pinned-bar-text { font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinned-bar-unpin { width: 30px; height: 30px; }
.pinned-bar-unpin svg { width: 15px; height: 15px; }
.pinned-mark { font-size: 11px; }
.bubble.is-pinned { box-shadow: 0 0 0 1.5px rgba(var(--accent-2-rgb), 0.45); }
.bubble-action-btn.pin-btn.active { color: var(--accent); }

/* ── Disappearing messages ─────────────────────────────────── */

.peer-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.peer-name-row .peer-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disappear-chip {
  display: inline-flex; align-items: center; gap: 3px; flex: none;
  padding: 2px 7px 2px 5px; border-radius: 99px;
  background: rgba(var(--accent-2-rgb), 0.16); color: var(--accent);
  font-size: 11px; font-weight: 750;
}
.disappear-chip svg { width: 12px; height: 12px; }
.expiry-mark { display: inline-grid; opacity: .8; }
.expiry-mark svg { width: 12px !important; height: 12px !important; }
.preview-timer { margin-right: 3px; font-size: 11px; }
.chat-system-note {
  display: flex; align-items: flex-start; gap: 8px;
  max-width: 440px; margin: 4px auto 14px; padding: 9px 14px; border-radius: 14px;
  background: var(--warn-bg); color: var(--warn-text);
  font-size: 12.5px; line-height: 1.45; text-align: left;
}
.chat-system-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }

/* ── View once ─────────────────────────────────────────────── */

.view-once {
  display: flex; align-items: center; gap: 12px; min-width: 190px;
  padding: 8px 12px 8px 8px; border-radius: 14px; border: none;
  background: rgba(0, 0, 0, 0.16); color: inherit; text-align: left; cursor: default;
}
.bubble.them .view-once { background: var(--hover-bg-soft); }
.view-once.is-ready { cursor: pointer; }
.view-once.is-ready:hover { background: rgba(0, 0, 0, 0.24); }
.bubble.them .view-once.is-ready:hover { background: var(--hover-bg); }
.view-once-badge {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  border: 2px dashed currentColor;
}
.view-once.is-ready .view-once-badge { border-style: solid; background: var(--grad-accent); color: var(--on-accent); border-color: transparent; box-shadow: 0 0 0 4px rgba(var(--accent-2-rgb), 0.2); }
.view-once.is-opened .view-once-badge, .view-once.is-sender .view-once-badge { opacity: .7; }
.view-once-body { display: flex; flex-direction: column; gap: 1px; }
.view-once-title { font-weight: 700; font-size: 14px; }
.view-once-state { font-size: 12px; opacity: .78; }

.view-once-viewer {
  position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, 0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; animation: pinned-in .2s ease;
}
.view-once-viewer img, .view-once-viewer video { max-width: 94vw; max-height: 82vh; border-radius: 12px; pointer-events: auto; }
.view-once-viewer img { pointer-events: none; }
.view-once-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; color: #fff; font-size: 13.5px; font-weight: 600;
  background: linear-gradient(rgba(0, 0, 0, 0.6), transparent);
}
.view-once-top .view-once-badge { width: 28px; height: 28px; font-size: 12px; border-style: solid; }
.view-once-top .icon-btn { margin-left: auto; color: #fff; }

/* ── Drafts ───────────────────────────────────────────────── */

.draft-label { color: var(--danger); font-weight: 700; }

/* ── Translate ────────────────────────────────────────────── */

.translation {
  margin-top: 8px; padding-top: 7px; border-top: 1px dashed rgba(255, 255, 255, 0.35);
  display: flex; flex-direction: column; gap: 3px;
}
.bubble.them .translation { border-top-color: var(--border); }
.translation-label { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; opacity: .8; }
.translation-label svg { width: 12px; height: 12px; }
.translation-text { white-space: pre-wrap; font-size: 14px; }
.translation.error .translation-label { color: var(--danger-text); opacity: 1; }
.translation.loading .translation-label { animation: ai-pulse 1s infinite ease-in-out alternate; }
@keyframes ai-pulse { from { opacity: .45; } to { opacity: .9; } }
.translation-change, .translation-hide {
  border: none; background: none; color: inherit; font: inherit; text-decoration: underline;
  cursor: pointer; padding: 0 0 0 6px; opacity: .85;
}
.lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lang-option {
  padding: 11px 8px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--hover-bg-soft); color: var(--text); font-weight: 600; cursor: pointer;
}
.lang-option:hover { background: var(--hover-bg); }
.lang-option.selected { border-color: var(--border-lit); background: rgba(var(--accent-2-rgb), 0.16); color: var(--accent); }

/* ── Smart replies chip ───────────────────────────────────── */

.suggest-chip.ai { display: inline-flex; align-items: center; gap: 6px; }
.suggest-chip.ai svg { width: 13px; height: 13px; color: var(--accent); flex: none; }
.suggest-chip.ai-ask {
  background: transparent; border: 1px dashed var(--border-lit); color: var(--accent); font-weight: 650;
}
.suggest-chip.ai-ask:disabled { opacity: .7; cursor: progress; }

/* ── Quick replies ─────────────────────────────────────────── */

.composer { position: relative; }
.quick-reply-popup {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); z-index: 30;
  max-height: 300px; overflow-y: auto; padding: 6px;
  /* --raised is slightly see-through by design; layer it over the page
     colour so chat bubbles never show through the popup. */
  background: linear-gradient(var(--raised), var(--raised)), var(--bg);
  border: 1px solid var(--border-lit); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); backdrop-filter: var(--glass-blur, none);
  animation: pinned-in .15s ease;
}
.qr-popup-head {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px;
  font-size: 11.5px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim);
}
.qr-popup-head svg { width: 13px; height: 13px; color: var(--accent); }
.qr-popup-manage, .qr-popup-create {
  margin-left: auto; border: none; background: none; color: var(--accent); font: 650 12px var(--font); cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.qr-popup-item {
  display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 9px 10px;
  border: none; border-radius: 10px; background: none; color: var(--text); text-align: left; cursor: pointer;
}
.qr-popup-item.active, .qr-popup-item:hover { background: var(--hover-bg); }
.qr-shortcut { font-weight: 750; color: var(--accent); font-size: 13px; flex: none; }
.qr-body { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-popup-empty { display: flex; align-items: center; gap: 6px; padding: 8px 10px 10px; font-size: 13px; color: var(--text-dim); }
.qr-popup-empty .qr-popup-create { margin-left: 0; }

.qr-list { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow-y: auto; }
.qr-row {
  display: flex; align-items: center; gap: 6px; padding: 10px 8px 10px 12px;
  border-radius: var(--r-sm); background: var(--hover-bg-soft); border: 1px solid var(--border);
}
.qr-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.qr-row-body { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.qr-row .icon-btn { width: 32px; height: 32px; flex: none; }
.qr-row .icon-btn svg { width: 15px; height: 15px; }
.qr-form { margin-top: 14px; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--border-lit); background: rgba(var(--accent-2-rgb), 0.06); }
.qr-form .field { margin-bottom: 12px; }
.qr-shortcut-input { display: flex; align-items: center; gap: 4px; }
.qr-shortcut-input span { font-weight: 800; color: var(--accent); font-size: 16px; }
.qr-shortcut-input input { flex: 1; }
.qr-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.qr-form-actions .btn-primary { width: auto; margin-top: 0; padding: 9px 18px; }

/* ── Security & logins ─────────────────────────────────────── */

.login-alert {
  position: fixed; top: 16px; left: 50%; z-index: 4000;
  transform: translate(-50%, -140%); transition: transform .35s cubic-bezier(.2, 1.2, .3, 1);
  width: min(560px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  background: linear-gradient(var(--raised), var(--raised)), var(--bg);
  border: 1px solid rgba(var(--danger-rgb), 0.45); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); backdrop-filter: var(--glass-blur, none);
}
.login-alert.show { transform: translate(-50%, 0); }
.login-alert-icon { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--danger-bg); color: var(--danger); }
.login-alert-icon svg { width: 20px; height: 20px; }
.login-alert-body { flex: 1; min-width: 0; }
.login-alert-title { font-weight: 750; font-size: 14px; }
.login-alert-sub { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-alert-review { padding: 8px 14px; flex: none; }
.login-alert-close { width: 30px; height: 30px; flex: none; }
.login-alert-close svg { width: 15px; height: 15px; }

.login-list { display: flex; flex-direction: column; gap: 2px; max-height: 38vh; overflow-y: auto; margin-bottom: 16px; }
.login-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.login-row:last-child { border-bottom: none; }
.login-row-icon { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--hover-bg); color: var(--accent); }
.login-row-icon svg { width: 18px; height: 18px; }
.login-row-body { flex: 1; min-width: 0; }
.login-row-device { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.login-latest { padding: 1px 7px; border-radius: 99px; background: rgba(var(--online-rgb), 0.16); color: var(--online); font-size: 10.5px; font-weight: 750; }
.login-row-sub { font-size: 12px; color: var(--text-dim); }
.login-row-when { font-size: 12px; color: var(--muted); white-space: nowrap; }

.danger-zone {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-md);
  background: var(--danger-bg); border: 1px solid rgba(var(--danger-rgb), 0.3);
}
.danger-zone > div { flex: 1; }
.danger-title { font-weight: 700; font-size: 14px; color: var(--danger-text); }
.danger-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.danger-zone + .danger-zone { margin-top: 10px; }

/* ── Mobile number + Gmail (sign-up, verify, change) ───────── */

.otp-row { display: flex; gap: 8px; align-items: stretch; }
.otp-row input { flex: 1; min-width: 0; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.otp-row input::placeholder { letter-spacing: normal; }
.otp-row .cf-send { flex: none; white-space: nowrap; padding: 0 14px; min-width: 112px; }
.otp-hint { font-size: 12.5px; margin-top: 7px; color: var(--text-dim); min-height: 0; }
.otp-hint:empty { display: none; }
.otp-hint.ok { color: var(--online, #22c55e); }
.verify-card { max-width: 440px; }
.verify-card form .modal-actions { margin-top: 6px; }
.contact-summary {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px;
  border-radius: var(--r-md); background: var(--inset-bg);
}
.contact-summary .btn-secondary { flex: none; }
.contact-ok { color: var(--online, #22c55e); font-weight: 600; }
.device-lock .danger-title { display: flex; align-items: center; gap: 6px; }
.device-lock .danger-title svg { width: 15px; height: 15px; flex: none; }

/* ── Broadcast lists ───────────────────────────────────────── */

.bc-lists { display: flex; flex-direction: column; gap: 8px; max-height: 45vh; overflow-y: auto; }
.bc-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 10px;
  border-radius: var(--r-md); background: var(--hover-bg-soft); border: 1px solid var(--border);
}
.bc-row-icon { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--grad-accent); color: var(--on-accent); }
.bc-row-icon svg { width: 19px; height: 19px; }
.bc-row-body { flex: 1; min-width: 0; }
.bc-row-name { font-weight: 700; font-size: 14px; }
.bc-row-sub { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-send { width: auto !important; margin: 0 !important; padding: 8px 12px !important; font-size: 12.5px; flex: none; }
.bc-row .icon-btn { width: 32px; height: 32px; flex: none; }
.bc-row .icon-btn svg { width: 15px; height: 15px; }
.bc-count { color: var(--accent); font-weight: 650; text-transform: none; letter-spacing: 0; }
.bc-search { margin-bottom: 8px; }
.pick-list { display: flex; flex-direction: column; max-height: 36vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.pick-row:last-child { border-bottom: none; }
.pick-row:hover { background: var(--hover-bg-soft); }
.pick-row .avatar.sm { width: 34px; height: 34px; font-size: 13px; flex: none; }
.pick-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; font-size: 14px; }
.pick-handle { font-weight: 400; font-size: 12px; color: var(--muted); }

/* ── Business profile ──────────────────────────────────────── */

.business-fields { overflow: hidden; transition: opacity .2s; }
.business-fields.collapsed { display: none; }
.biz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.business-block { border-top: 1px solid var(--border); padding-top: 14px; }
.biz-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  background: rgba(var(--accent-2-rgb), 0.16); color: var(--accent); font-size: 12px; font-weight: 750;
}
.biz-badge svg { width: 13px; height: 13px; }
.biz-description { margin: 10px 0 6px; font-size: 13.5px; line-height: 1.5; color: var(--text); }
.biz-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; font-size: 13.5px; color: var(--text-dim); }
.biz-row svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent); }
.biz-row a { color: var(--text); text-decoration: none; word-break: break-word; }
.biz-row a:hover { color: var(--accent); text-decoration: underline; }

/* ── Effects ──────────────────────────────────────────────── */

.effects-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 5000; }

/* ── Tic-tac-toe ──────────────────────────────────────────── */

.ttt-board {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px;
  width: min(300px, 78vw); margin: 6px auto 14px; aspect-ratio: 1;
}
.ttt-cell {
  border: none; border-radius: 16px; background: var(--hover-bg); color: var(--text);
  font-size: clamp(34px, 11vw, 52px); font-weight: 800; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: background .15s, transform .12s;
}
.ttt-cell:hover:not(:disabled) { background: var(--hover-bg-strong); }
.ttt-cell:active:not(:disabled) { transform: scale(0.95); }
.ttt-cell:disabled { cursor: default; }
.ttt-cell.is-X { color: var(--accent); }
.ttt-cell.is-O { color: #FDCB6E; }
.ttt-cell.win { background: rgba(var(--online-rgb), 0.2); box-shadow: inset 0 0 0 2px var(--online); }
.ttt-score { display: flex; justify-content: center; gap: 18px; margin: 8px 0 10px; font-size: 13px; color: var(--text-dim); }
.ttt-score b { color: var(--text); font-size: 15px; margin-left: 4px; }
#ttt-controls .btn-primary, #sl-controls .btn-primary { width: auto; padding: 10px 22px; margin: 4px auto 0; display: block; }

/* ── Snake & Ladder ───────────────────────────────────────── */

.sl-board {
  display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(10, 1fr); gap: 2px;
  width: min(420px, 86vw); margin: 4px auto 12px; aspect-ratio: 1;
  padding: 4px; border-radius: 14px; background: var(--hover-bg);
}
.sl-cell {
  position: relative; border-radius: 5px; background: var(--panel-3);
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 1px; overflow: hidden;
}
.sl-cell.alt { background: var(--hover-bg-soft); }
.sl-cell.goal { background: rgba(var(--online-rgb), 0.22); }
.sl-n { position: absolute; top: 1px; left: 3px; font-size: clamp(7px, 1.6vw, 9px); color: var(--muted); font-weight: 650; }
.sl-mark { position: absolute; bottom: 0; right: 1px; font-size: clamp(9px, 2.4vw, 13px); line-height: 1; display: flex; align-items: flex-end; }
.sl-mark i { font-style: normal; font-size: clamp(6px, 1.4vw, 8px); font-weight: 750; }
.sl-mark.snake i { color: var(--danger); }
.sl-mark.ladder i { color: var(--online); }
.sl-token { width: clamp(9px, 2.6vw, 14px); height: clamp(9px, 2.6vw, 14px); border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); z-index: 1; display: inline-block; vertical-align: middle; }
.sl-token.host { background: #2F80FF; }
.sl-token.guest { background: #FF8A3D; }
.sl-token.me { outline: 2px solid #fff; outline-offset: 1px; }
.sl-last { text-align: center; font-size: 12.5px; color: var(--text-dim); margin: 6px 0; min-height: 18px; }
.sl-start { text-align: center; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.sl-roll { font-size: 15px !important; }

@media (max-width: 520px) {
  .biz-grid { grid-template-columns: 1fr; }
  .lang-grid { grid-template-columns: repeat(2, 1fr); }
  .danger-zone { flex-direction: column; align-items: stretch; text-align: center; }
  .bc-row { flex-wrap: wrap; }
  .bc-send { order: 5; flex: 1 0 100%; }
  .login-alert-review { display: none; }
}

/* ── Recovery key & forgot password ────────────────────────── */

.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.field-label-row label { margin-bottom: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--accent-2); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.field-optional { font-weight: 500; color: var(--muted); }
.contact-warn { color: #f5a524; font-weight: 600; }

.recovery-key {
  font: 700 19px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 1.5px;
  text-align: center; padding: 18px 12px; border-radius: var(--r-md); word-break: break-all;
  background: var(--inset-bg); border: 1.5px dashed var(--border-lit); color: var(--text); user-select: all;
}
.recovery-actions { display: flex; gap: 8px; justify-content: center; margin: 12px 0 14px; }
.recovery-actions .btn-secondary { display: inline-flex; align-items: center; gap: 6px; }
.recovery-actions svg { width: 16px; height: 16px; }
.recovery-check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.recovery-check input { margin-top: 2px; accent-color: var(--accent); }

.btn-danger-soft {
  padding: 9px 16px; border-radius: var(--r-md); border: 1px solid rgba(var(--danger-rgb), .35);
  background: var(--danger-bg); color: var(--danger-text); font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-danger-soft:hover { background: rgba(var(--danger-rgb), .24); border-color: rgba(var(--danger-rgb), .6); }
#fp-sent { margin-bottom: 12px; }
.menu-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.menu-badge.hidden { display: none; }


/* ── Group info ────────────────────────────────────────────── */

.modal-card.ginfo-card { max-width: 500px; }
.ginfo-head { text-align: center; margin-bottom: 18px; }
.ginfo-avatar { width: 84px; height: 84px; font-size: 30px; margin: 0 auto 10px; }
.ginfo-title { font-size: 20px; font-weight: 800; letter-spacing: -.2px; overflow-wrap: anywhere; }
.ginfo-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.ginfo-desc { margin: 12px auto 0; max-width: 400px; font-size: 13.5px; line-height: 1.5; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.ginfo-desc.empty { color: var(--muted); font-style: italic; }
.ginfo-edit { margin-top: 12px; display: inline-flex; align-items: center; gap: 7px; }
.ginfo-edit svg { width: 15px; height: 15px; }
.ginfo-section { border-top: 1px solid var(--border); padding: 14px 0 6px; }
.ginfo-section-title {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  font-size: 12.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 10px;
}
.ginfo-section-title .link-btn { text-transform: none; letter-spacing: 0; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.ginfo-section-title .link-btn svg { width: 15px; height: 15px; }
.ginfo-count { margin-right: auto; background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 1px 8px; font-size: 11px; }
.ginfo-members { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; }
.ginfo-member { display: flex; align-items: center; gap: 11px; padding: 7px 6px; border-radius: 10px; }
.ginfo-member:hover { background: var(--inset-bg); }
.ginfo-member-main { flex: 1; min-width: 0; }
.ginfo-member-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ginfo-member-name .muted { color: var(--muted); font-weight: 500; }
.ginfo-member-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ginfo-member .role-tag {
  font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .3px;
  background: rgba(var(--accent-rgb), .15); color: var(--accent);
}
.ginfo-member .role-tag.owner { background: rgba(245, 165, 36, .16); color: #f5a524; }
.ginfo-member .btn-primary, .ginfo-member .btn-secondary { padding: 6px 12px; font-size: 12.5px; }
.ginfo-more { width: 30px; height: 30px; font-size: 18px; line-height: 1; color: var(--text-dim); }
.ginfo-invite { margin-top: 10px; }
.ginfo-invite-row { display: flex; align-items: center; gap: 12px; }
.ginfo-invite-icon { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--inset-bg); color: var(--text-dim); }
.ginfo-invite-icon.on { background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.ginfo-invite-icon svg { width: 19px; height: 19px; }
.ginfo-invite-main { flex: 1; min-width: 0; }
.invite-url { font-size: 12.5px; color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; font-family: ui-monospace, Consolas, monospace; }
.invite-actions { display: flex; gap: 8px; margin: 10px 0 4px 50px; flex-wrap: wrap; }
.invite-actions .btn-secondary { padding: 6px 12px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.invite-actions svg { width: 14px; height: 14px; }
.join-note { font-size: 13px; color: var(--text-dim); text-align: center; line-height: 1.5; margin: 0 0 6px; }

.pop-menu {
  position: fixed; z-index: 5000; min-width: 190px; padding: 6px; border-radius: 12px;
  background: var(--raised); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.pop-menu button {
  text-align: left; padding: 9px 12px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px;
  border-radius: 8px; cursor: pointer;
}
.pop-menu button:hover { background: var(--inset-bg); }
.pop-menu button.danger { color: var(--danger); }

/* Admin-only groups: the composer gives way to a notice. */
.admins-only-bar {
  display: flex; align-items: center; justify-content: center; gap: 9px; padding: 14px 16px; margin: 0 12px 12px;
  border-radius: var(--r-md); background: var(--inset-bg); color: var(--text-dim); font-size: 13.5px; text-align: center;
}
.admins-only-bar svg { width: 17px; height: 17px; flex: none; color: var(--accent); }
.composer.hidden { display: none; }

/* @everyone */
.mention-pop {
  position: absolute; bottom: calc(100% + 6px); left: 12px; z-index: 30; padding: 5px; border-radius: 12px;
  background: var(--raised); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.mention-pop button { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; border-radius: 8px; text-align: left; }
.mention-pop button:hover { background: var(--inset-bg); }
.mention-pop svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.mention-pop small { display: block; font-size: 11.5px; color: var(--muted); }
.mention-all { font-weight: 700; color: var(--accent-2); background: rgba(var(--accent-rgb), .14); padding: 0 4px; border-radius: 5px; }
.bubble.me .mention-all { color: inherit; background: rgba(255, 255, 255, .2); }
.mention-all-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; opacity: .75; margin-bottom: 2px; }

/* Reply privately */
.private-quote { border-left: 3px solid var(--accent-2); background: rgba(0, 0, 0, .14); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; max-width: 320px; }
.bubble.me .private-quote { border-left-color: rgba(255, 255, 255, .8); background: rgba(0, 0, 0, .16); }
.private-quote-head { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; opacity: .9; }
.private-quote-head svg { width: 12px; height: 12px; }
.private-quote-text { font-size: 12.5px; opacity: .85; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.private-quote-bar { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 8px 8px 8px 10px; border-radius: var(--r-md); background: var(--inset-bg); }
.private-quote-bar .private-quote { flex: 1; margin: 0; max-width: none; background: none; }

/* Chat list */
.badge.join-badge { background: #f5a524; color: #1a1300; }

/* Communities */
.community-list { display: flex; flex-direction: column; gap: 12px; max-height: 56vh; overflow-y: auto; }
.community { border-radius: var(--r-md); background: var(--inset-bg); padding: 12px; }
.community-head { display: flex; align-items: center; gap: 12px; }
.community-avatar { width: 46px; height: 46px; border-radius: 14px; font-size: 16px; flex: none; }
.community-main { flex: 1; min-width: 0; }
.community-name { font-weight: 800; font-size: 15px; }
.community-sub { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.community .comm-more { width: 32px; height: 32px; font-size: 18px; }
.community-groups { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); padding-top: 8px; }
.community-group { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.community-group .avatar svg { width: 16px; height: 16px; }
.community-group.ann .avatar { border-radius: 10px; }
.community-group-main { flex: 1; min-width: 0; }
.community-group-name { font-weight: 600; font-size: 13.5px; }
.community-group-sub { font-size: 12px; color: var(--muted); }
.community-group .btn-secondary { padding: 6px 12px; font-size: 12.5px; }
.g-requested { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Poll deadlines */
.poll-head { flex-wrap: wrap; }
.poll-deadline { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; opacity: .85; }
.poll-deadline svg { width: 12px; height: 12px; }
.poll-deadline.done { opacity: .7; }
.poll-card.closed .poll-option { cursor: default; }
.poll-footer-row { display: flex; border-top: 1px solid rgba(255, 255, 255, 0.18); margin-top: 4px; }
.bubble.them .poll-footer-row { border-top-color: var(--border); }
.poll-footer-row .poll-footer { flex: 1; border-top: 0; margin-top: 0; }
.poll-close-btn {
  border: 0; border-left: 1px solid rgba(255, 255, 255, 0.18); background: none; color: inherit; font: inherit;
  font-size: 12.5px; font-weight: 650; padding: 8px 12px; cursor: pointer; opacity: .85;
}
.bubble.them .poll-close-btn { border-left-color: var(--border); color: var(--danger); }
.poll-close-btn:hover { background: rgba(255, 255, 255, 0.06); }
.poll-deadline-field select, .poll-deadline-field input { width: 100%; }
.poll-deadline-field input { margin-top: 8px; }


/* ── Voice: speed + mini-player ────────────────────────────── */

.voice-speed-btn {
  flex: none; min-width: 34px; height: 22px; padding: 0 6px; border-radius: 99px; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.24); color: inherit; font: inherit; font-size: 11px; font-weight: 800;
}
.voice-speed-btn:hover { background: rgba(0, 0, 0, 0.36); }
.voice-player { position: relative; }
.voice-player.is-playing::after {
  content: ""; position: absolute; left: 46px; right: 4px; bottom: -2px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, currentColor var(--voice-progress, 0%), rgba(127, 127, 127, .25) var(--voice-progress, 0%));
  opacity: .8;
}
.voice-mini {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3500;
  width: min(520px, calc(100vw - 24px)); display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 16px; background: var(--raised); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: vm-in .25s ease-out;
}
@keyframes vm-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.voice-mini .vm-play { width: 36px; height: 36px; border-radius: 50%; background: var(--grad-accent); color: var(--on-accent); flex: none; }
.voice-mini .vm-play svg { width: 15px; height: 15px; }
.vm-main { flex: 1; min-width: 0; cursor: pointer; }
.vm-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vm-track { height: 4px; border-radius: 4px; background: var(--inset-bg); margin-top: 6px; overflow: hidden; cursor: pointer; }
.vm-track i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.vm-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vm-speed {
  min-width: 42px; height: 28px; border-radius: 99px; border: 1px solid var(--border); background: var(--inset-bg);
  color: var(--text); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.voice-mini .vm-close svg { width: 16px; height: 16px; }
@media (max-width: 560px) { .vm-time { display: none; } }

/* ── Edit history ──────────────────────────────────────────── */

button.edited-tag { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-size: 10.5px; font-style: italic; opacity: .65; cursor: pointer; }
button.edited-tag:hover { opacity: 1; text-decoration: underline; }
.edit-history { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; }
.edit-version { padding: 10px 13px; border-radius: var(--r-md); background: var(--inset-bg); border-left: 3px solid var(--border-lit); }
.edit-version.current { border-left-color: var(--accent); }
.edit-version-head { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--text-dim); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
.edit-version-when { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.edit-version-text { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Chat lock ─────────────────────────────────────────────── */

.locked-row {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 16px); margin: 4px 8px 6px; padding: 11px 14px;
  border-radius: var(--r-md); border: 1px dashed var(--border-lit); background: var(--inset-bg); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
button.locked-row:hover { background: var(--panel-3); }
.locked-row.open { border-style: solid; border-color: rgba(var(--accent-rgb), .4); cursor: default; }
.locked-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .14); color: var(--accent); flex: none; }
.locked-icon svg { width: 17px; height: 17px; }
.locked-title { flex: 1; font-weight: 650; font-size: 14px; }
.locked-sub { color: var(--muted); font-size: 12.5px; }
.pin-card .pin-input { letter-spacing: 8px; font-size: 20px; text-align: center; font-variant-numeric: tabular-nums; }

/* ── Stickers from photos ──────────────────────────────────── */

.mp-section-title { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 4px 2px 8px; }
.my-stickers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.mp-make-sticker, .mp-my-sticker {
  aspect-ratio: 1; border-radius: var(--r-md); border: 1.5px dashed var(--border-lit); background: var(--inset-bg);
  color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; padding: 4px;
}
.mp-make-sticker svg { width: 22px; height: 22px; }
.mp-my-sticker { border-style: solid; border-color: transparent; background: none; }
.mp-my-sticker:hover, .mp-make-sticker:hover { background: var(--panel-3); }
.mp-my-sticker img { width: 100%; height: 100%; object-fit: contain; }
.sticker-card { max-width: 420px; }
.sticker-stage {
  width: min(300px, 100%); aspect-ratio: 1; margin: 0 auto 6px; border-radius: 18px; overflow: hidden; touch-action: none;
  background: repeating-conic-gradient(rgba(127, 127, 127, .18) 0 25%, transparent 0 50%) 0 0 / 20px 20px;
}
.sticker-stage canvas { width: 100%; height: 100%; cursor: grab; display: block; }
.sticker-stage canvas:active { cursor: grabbing; }
.sticker-hint { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.sticker-shapes { display: flex; gap: 8px; margin-bottom: 14px; }
.sticker-shapes button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 6px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--inset-bg); color: var(--text-dim); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.sticker-shapes button.active { border-color: var(--accent); color: var(--text); background: rgba(var(--accent-rgb), .1); }
.sticker-shapes span { width: 22px; height: 22px; background: currentColor; opacity: .7; }
.shape-rounded { border-radius: 7px; }
.shape-circle { border-radius: 50%; }
.sticker-text-row { display: flex; gap: 8px; align-items: center; }
.sticker-text-row input { flex: 1; }
.st-color { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; }
.st-color.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .35); }
#st-send { display: inline-flex; align-items: center; gap: 7px; }
#st-send svg { width: 16px; height: 16px; }

/* ── Search filters ────────────────────────────────────────── */

.chat-search-filters {
  position: absolute; top: calc(100% + 53px); left: 0; right: 0; z-index: 14;
  display: flex; align-items: center; gap: 6px; padding: 8px 20px; overflow-x: auto; scrollbar-width: none;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.chat-search-filters::-webkit-scrollbar { display: none; }
.search-chip {
  flex: none; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--inset-bg);
  color: var(--text-dim); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.search-chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.search-from { flex: none; padding: 5px 8px; border-radius: 99px; border: 1px solid var(--border); background: var(--inset-bg); color: var(--text); font: inherit; font-size: 12.5px; }
.search-date { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12.5px; }
.search-date svg { width: 15px; height: 15px; }
.search-date input { border: 1px solid var(--border); background: var(--inset-bg); color: var(--text); border-radius: 8px; padding: 3px 6px; font: inherit; font-size: 12px; color-scheme: dark; }
:root[data-theme="light"] .search-date input { color-scheme: light; }

/* Search open: the bars sit over the top of the chat, so the messages start below them. */
.chat-pane.search-open #messages { padding-top: 112px; }
@media (min-width: 900px) {
  /* Desktop: the voice mini-player sits at the bottom of the chat list, clear of the message box. */
  .voice-mini { left: 24px; transform: none; width: 340px; bottom: 24px; animation-name: vm-in-left; }
  @keyframes vm-in-left { from { opacity: 0; transform: translateY(12px); } }
}
@media (max-width: 899px) { .voice-mini { bottom: 92px; } }

/* ── Calls ─────────────────────────────────────────────────── */

.calls-btn { position: relative; }
.calls-badge {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--panel);
}
.calls-badge.hidden { display: none; }
.modal-card.calls-card { max-width: 480px; }
.calls-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal-card.calls-card .calls-head h3 { margin: 0; flex: 1; display: flex; align-items: center; gap: 9px; }
.calls-head h3 svg { width: 20px; height: 20px; color: var(--accent); }
.calls-head .link-btn { display: inline-flex; align-items: center; gap: 5px; }
.calls-head .link-btn svg { width: 14px; height: 14px; }
.calls-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.calls-tab {
  padding: 6px 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--inset-bg);
  color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.calls-tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.calls-list { display: flex; flex-direction: column; gap: 2px; max-height: 58vh; overflow-y: auto; margin: 0 -6px; }
.call-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 12px; cursor: pointer; }
.call-row:hover { background: var(--inset-bg); }
.call-row .avatar { width: 44px; height: 44px; flex: none; }
.call-row-main { flex: 1; min-width: 0; }
.call-row-name { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-row.missed .call-row-name { color: var(--danger); }
.call-row-sub { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-dim); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.call-arrow { width: 14px; height: 14px; flex: none; color: var(--online); }
.call-arrow.missed, .call-arrow.declined { color: var(--danger); }
.call-again { width: 36px; height: 36px; flex: none; color: var(--accent); }
.call-again svg { width: 18px; height: 18px; }
.calls-empty { text-align: center; padding: 40px 10px; color: var(--text-dim); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.calls-empty svg { width: 40px; height: 40px; color: var(--muted); margin-bottom: 4px; }
.calls-empty small { color: var(--muted); }

.ringtone-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.ringtone-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.ringtone-row:hover { background: var(--inset-bg); }
.ringtone-row input { accent-color: var(--accent); width: 18px; height: 18px; }
.ringtone-name { flex: 1; font-weight: 600; font-size: 14px; }
.ringtone-name small { color: var(--muted); font-weight: 500; }
.rt-play { width: 32px; height: 32px; color: var(--accent); }
.rt-play svg { width: 14px; height: 14px; fill: currentColor; }
#group-call-screen-btn.active { background: var(--accent); color: var(--on-accent); }
.chat-menu button.menu-danger { color: var(--danger); }

/* ── Business: catalogue, products, away, notes ────────────── */

.product-card { width: min(260px, 62vw); border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .16); margin: -2px -4px 4px; }
.product-photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: rgba(0, 0, 0, .2); }
.product-photo.empty { display: grid; place-items: center; color: rgba(255, 255, 255, .5); }
.product-photo.empty svg { width: 34px; height: 34px; }
.product-info { padding: 9px 11px 10px; }
.product-name { font-weight: 700; font-size: 14.5px; }
.product-price { font-weight: 800; font-size: 14px; margin-top: 2px; color: var(--online); }
.bubble.me .product-price { color: inherit; }
.product-price.big { font-size: 20px; margin: 2px 0 10px; }
.product-desc { font-size: 12.5px; opacity: .85; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.product-more {
  margin-top: 8px; width: 100%; padding: 7px; border-radius: 9px; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: inherit; font: inherit; font-size: 12.5px; font-weight: 700;
}
.product-more:hover { background: rgba(255, 255, 255, .2); }
.product-hero { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--r-md); margin-bottom: 14px; }
.product-desc-full { color: var(--text-dim); font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
#prod-send { display: inline-flex; align-items: center; gap: 7px; }
#prod-send svg { width: 16px; height: 16px; }

.auto-tag { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; opacity: .7; margin-bottom: 3px; }
.auto-tag svg { width: 12px; height: 12px; }

.modal-card.catalog-card { max-width: 620px; }
.catalog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-card .catalog-head h3 { margin: 0; flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; }
.catalog-head h3 svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.catalog-head .btn-primary { display: inline-flex; align-items: center; gap: 6px; }
.catalog-head .btn-primary svg { width: 15px; height: 15px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 60vh; overflow-y: auto; }
.catalog-tile {
  display: flex; flex-direction: column; text-align: left; padding: 0 0 10px; border-radius: 14px; overflow: hidden; cursor: pointer;
  background: var(--inset-bg); border: 1px solid var(--border); color: var(--text); font: inherit; transition: transform .12s, border-color .12s;
}
.catalog-tile:hover { transform: translateY(-2px); border-color: var(--border-lit); }
.catalog-tile.off { opacity: .55; }
.catalog-tile img, .catalog-noimg { width: 100%; aspect-ratio: 1; object-fit: cover; display: grid; place-items: center; background: rgba(0, 0, 0, .2); color: var(--muted); }
.catalog-noimg svg { width: 30px; height: 30px; }
.catalog-noimg.sm { width: 46px; height: 46px; aspect-ratio: auto; border-radius: 10px; flex: none; }
.catalog-noimg.sm svg { width: 20px; height: 20px; }
.catalog-name { font-weight: 650; font-size: 13.5px; padding: 8px 10px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-price { font-size: 12.5px; color: var(--online); font-weight: 700; padding: 2px 10px 0; }
.catalog-manage { display: flex; flex-direction: column; gap: 6px; max-height: 58vh; overflow-y: auto; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--inset-bg); }
.cat-row.off { opacity: .6; }
.cat-row img { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; flex: none; }
.cat-row-main { flex: 1; min-width: 0; }
.cat-row-main .catalog-name, .cat-row-main .catalog-price { padding: 0; }
.cat-row .icon-btn { width: 30px; height: 30px; font-size: 11px; }
.cat-row .icon-btn svg { width: 15px; height: 15px; }
.cat-row .icon-btn:disabled { opacity: .3; }
.prod-photo-pick {
  height: 170px; border-radius: var(--r-md); border: 1.5px dashed var(--border-lit); background: var(--inset-bg);
  display: grid; place-items: center; overflow: hidden; cursor: pointer; margin-bottom: 14px; color: var(--accent); font-weight: 600;
}
.prod-photo-pick span { display: inline-flex; align-items: center; gap: 6px; }
.prod-photo-pick svg { width: 18px; height: 18px; }
.prod-photo-pick img { width: 100%; height: 100%; object-fit: cover; }

.biz-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.biz-tools.hidden { display: none; }
.biz-tools .btn-secondary, .biz-catalog-btn { display: inline-flex; align-items: center; gap: 7px; }
.biz-tools svg, .biz-catalog-btn svg { width: 15px; height: 15px; }
.biz-catalog-btn { margin-top: 10px; width: 100%; justify-content: center; }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--inset-bg); }
.seg button { flex: 1; padding: 8px; border: 0; border-radius: 9px; background: none; color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.active { background: var(--panel-3); color: var(--text); }
.day-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip { padding: 6px 11px; border-radius: 99px; border: 1px solid var(--border); background: var(--inset-bg); color: var(--text-dim); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.day-chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
#aw-hours.hidden { display: none; }
.note-updated { font-size: 12px; color: var(--muted); margin-top: -6px; }

/* ── Archive, date of birth ────────────────────────────────── */
.archived-row {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 16px); margin: 4px 8px 6px; padding: 11px 14px;
  border-radius: var(--r-md); border: 0; background: var(--inset-bg); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.archived-row:hover { background: var(--panel-3); }
.archived-row.open .locked-icon { background: var(--inset-bg); color: var(--text-dim); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field input[type="date"] { color-scheme: dark; }
:root[data-theme="light"] .field input[type="date"] { color-scheme: light; }


/* ═══ Layout fixes (alignment audit) ═══════════════════════════════════
   Side panels (Calls, QR, Reminders, Starred, App lock, Blocked, Linked devices,
   Broadcasts, Quick replies, Communities ...) used to leave the Done row floating
   in the middle of the screen, or pushed it below the fold (Storage, Security).
   Now the panel is a column and the Done / Save row is pinned to its bottom edge. */
.modal-backdrop.as-panel > .modal-card.panel-card { display: flex; flex-direction: column; }
.modal-backdrop.as-panel > .modal-card.panel-card > * { flex-shrink: 0; }
.as-panel .modal-actions {
  margin: auto -18px 0;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  position: sticky; bottom: 0; z-index: 2;
  background: var(--panel);
  border-top: 1px solid var(--border);
}
.as-panel .modal-actions > .btn-primary,
.as-panel .modal-actions > .btn-secondary { flex: 1 1 0; text-align: center; }
.as-panel .modal-actions > .btn-primary:only-child { flex: 1 1 100%; }
.as-panel .modal-actions:not(:last-child) { position: static; margin: 20px 0 0; padding: 0; border: 0; background: none; }
.as-panel .modal-actions:not(:last-child) > .btn-primary,
.as-panel .modal-actions:not(:last-child) > .btn-secondary { flex: 0 0 auto; }
.login-latest { font-size: 11.5px; }#composer-input { scrollbar-width: none; }
#composer-input::-webkit-scrollbar { display: none; }
/* composer: input and language picker same height as the round buttons, so the row lines up */
.composer-box #composer-input { min-height: 36px; }
.composer-box #speech-lang-select, .composer-box .speech-lang-select { height: 36px; }
#speech-lang-select { height: 36px; }
/* QR sign-in card: heading lines up with the eyebrow and the paragraph under it */
.welcome-eyebrow ~ .auth-card-heading { text-align: start; }

/* A run of messages sealed to another device, folded into one slim note. */
.sealed-note {
  align-self: center; max-width: min(520px, 92%); margin: 6px auto;
  padding: 7px 14px; border-radius: 12px; text-align: center;
  font-size: 12px; line-height: 1.4; color: var(--text-dim);
  background: var(--inset-bg);
}

/* Group profile picture picker (create-group + group info). */
.group-photo-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 14px; }
.group-photo-pick .avatar { width: 84px; height: 84px; font-size: 28px; cursor: pointer; overflow: hidden; }
.group-photo-pick .avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Green dot only while they are online; no grey dot when they are not. */
.avatar .dot:not(.online) { display: none !important; }
.contact-info-hero .avatar { cursor: zoom-in; }
