/* =====================================================================
   Reusable components
   ===================================================================== */

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 42px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast),
              transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

.btn-primary {
  background: var(--bubble-out-solid);
  color: #fff;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--bubble-out-solid) 32%, transparent);
}
.btn-primary:hover { background: var(--brand-600); }

.btn-ghost { background: var(--bg-hover); color: var(--text); }
.btn-ghost:hover { background: var(--bg-active); }

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-outline:hover { background: var(--bg-hover); border-color: var(--text-faint); }

.btn-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(1.08); }

.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 var(--sp-4); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg { height: 48px; font-size: var(--fs-lg); }

.link-btn {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: color var(--t-fast);
}
.link-btn:hover { color: var(--brand-500); }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-strong); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.is-active { color: var(--brand-500); background: var(--bg-active); }
.icon-btn:disabled { opacity: .4; pointer-events: none; }

/* ---------------------------------------------------------------------
   Avatars
   --------------------------------------------------------------------- */
.avatar {
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-sunken);
  user-select: none;
}
.avatar-xs { width: 26px; height: 26px; }
.avatar-sm { width: 34px; height: 34px; }
.avatar-md { width: 42px; height: 42px; }
.avatar-lg { width: 52px; height: 52px; }
.avatar-xl { width: 96px; height: 96px; }
.avatar-2xl { width: 124px; height: 124px; }

.avatar-wrap { position: relative; flex: none; }

.presence-dot {
  position: absolute;
  inset-block-end: 1px;
  inset-inline-end: 1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--text-faint);
  border: 2.2px solid var(--bg-surface);
  transition: background var(--t-base);
}
.presence-dot.is-online { background: var(--success); }
.avatar-xl + .presence-dot,
.avatar-2xl + .presence-dot { width: 18px; height: 18px; border-width: 3px; }

/* ---------------------------------------------------------------------
   Badges
   --------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--bubble-out-solid);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.badge-muted { background: var(--text-faint); }
.badge-dot { min-width: 9px; width: 9px; height: 9px; padding: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-full);
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.chip-brand { background: color-mix(in srgb, var(--brand-500) 14%, transparent); color: var(--brand-500); }
.chip-owner { background: color-mix(in srgb, var(--accent-amber) 18%, transparent); color: var(--accent-amber); }
.chip-admin { background: color-mix(in srgb, var(--accent-violet) 18%, transparent); color: var(--accent-violet); }

/* ---------------------------------------------------------------------
   Form fields
   --------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

.field label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  background: var(--bg-sunken);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.field textarea { height: auto; min-height: 88px; padding: var(--sp-3) var(--sp-4); line-height: var(--lh-normal); resize: vertical; }
.field select { cursor: pointer; }

.field input::placeholder,
.field textarea::placeholder { color: var(--text-faint); }

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--brand-400);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand-400) 16%, transparent);
}

.field.has-error input,
.field.has-error textarea { border-color: var(--danger); }
.field.has-error { animation: shake .38s var(--ease-inout); }

.field-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  min-height: 15px;
  line-height: 1.3;
}

.field-hint { font-size: var(--fs-xs); color: var(--text-faint); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { padding-inline-end: 44px; }
.input-action {
  position: absolute;
  inset-inline-end: 6px;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: var(--text-faint);
  transition: color var(--t-fast), background var(--t-fast);
}
.input-action:hover { color: var(--text); background: var(--bg-hover); }

.checkbox, .radio {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: var(--fs-md);
  color: var(--text-muted);
  user-select: none;
  margin-bottom: var(--sp-4);
}
.checkbox input, .radio input { width: 17px; height: 17px; accent-color: var(--bubble-out-solid); cursor: pointer; }

.switch {
  position: relative;
  display: inline-block;
  width: 42px; height: 24px;
  flex: none;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--r-full);
  transition: background var(--t-base);
  cursor: pointer;
}
.switch span::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t-base) var(--ease-spring);
  box-shadow: var(--shadow-xs);
}
.switch input:checked + span { background: var(--bubble-out-solid); }
.switch input:checked + span::before { transform: translateX(18px); }
html[dir="rtl"] .switch input:checked + span::before { transform: translateX(-18px); }

.pw-meter {
  height: 4px;
  background: var(--bg-active);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: 2px;
}
.pw-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  background: var(--danger);
  transition: width var(--t-base) var(--ease-out), background var(--t-base);
}
.pw-meter[data-score="2"] span { background: var(--warning); }
.pw-meter[data-score="3"] span { background: var(--info); }
.pw-meter[data-score="4"] span { background: var(--success); }

/* ---------------------------------------------------------------------
   Auth screen
   --------------------------------------------------------------------- */
.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  overflow-y: auto;
  background: var(--bg-app);
}

.auth-backdrop { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: .34;
  animation: float 18s var(--ease-inout) infinite;
}
.orb-1 { width: 420px; height: 420px; background: var(--brand-400); top: -110px; inset-inline-start: -90px; }
.orb-2 { width: 360px; height: 360px; background: var(--accent-violet); bottom: -110px; inset-inline-end: -70px; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; background: var(--accent-teal); top: 46%; inset-inline-end: 22%; animation-delay: -12s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(28px, -34px) scale(1.08); }
  66%      { transform: translate(-22px, 22px) scale(.94); }
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 428px;
  padding: var(--sp-8) var(--sp-6) var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: popIn var(--t-slow) var(--ease-out);
}

.auth-head { text-align: center; margin-bottom: var(--sp-6); }
.auth-logo {
  width: 68px; height: 68px;
  margin: 0 auto var(--sp-4);
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #fff;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--brand-500) 40%, transparent);
}
.auth-title { font-size: var(--fs-2xl); font-weight: 700; color: var(--text-strong); letter-spacing: -.4px; }
.auth-tagline { font-size: var(--fs-md); color: var(--text-muted); margin-top: 4px; }

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 4px;
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-5);
}
.auth-tab {
  position: relative;
  z-index: 1;
  height: 38px;
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--t-base);
}
.auth-tab.is-active { color: var(--text-strong); }
.auth-tab-indicator {
  position: absolute;
  z-index: 0;
  inset-block: 4px;
  inset-inline-start: 4px;
  width: calc(50% - 5px);
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-base) var(--ease-out);
}
.auth-tabs[data-tab="register"] .auth-tab-indicator { transform: translateX(calc(100% + 2px)); }
html[dir="rtl"] .auth-tabs[data-tab="register"] .auth-tab-indicator { transform: translateX(calc(-100% - 2px)); }

.auth-form { display: none; }
.auth-form.is-active { display: block; animation: fadeIn var(--t-base) var(--ease-out); }

.auth-alert {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--danger) 11%, transparent);
  color: var(--danger);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  animation: slideUp var(--t-base) var(--ease-out);
}
.auth-alert.is-success {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.auth-foot { margin-top: var(--sp-5); text-align: center; }

/* ---------------------------------------------------------------------
   Chat list rows
   --------------------------------------------------------------------- */
.chat-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  text-align: start;
  cursor: pointer;
  transition: background var(--t-fast);
  position: relative;
}
.chat-list { padding: var(--sp-2); display: flex; flex-direction: column; gap: 1px; }
.chat-row:hover { background: var(--bg-hover); }
.chat-row.is-active { background: var(--bubble-out-solid); }
.chat-row.is-active .row-name,
.chat-row.is-active .row-preview,
.chat-row.is-active .row-time,
.chat-row.is-active .row-sender { color: #fff; }
.chat-row.is-active .row-preview,
.chat-row.is-active .row-time { opacity: .85; }
.chat-row.is-active .badge { background: #fff; color: var(--bubble-out-solid); }
.chat-row.is-active .presence-dot { border-color: var(--bubble-out-solid); }

.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-top, .row-bottom { display: flex; align-items: center; gap: var(--sp-2); }

.row-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-time { flex: none; font-size: var(--fs-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; }

.row-preview {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sender { color: var(--text-muted); font-weight: 500; }

.row-flags { display: flex; align-items: center; gap: 5px; flex: none; }
.row-flags svg { color: var(--text-faint); }

.chat-row.is-muted .row-name { color: var(--text-muted); }

/* ---------------------------------------------------------------------
   Search results
   --------------------------------------------------------------------- */
.search-results { padding: var(--sp-2); }
.result-group { margin-bottom: var(--sp-4); }
.result-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: var(--sp-2) var(--sp-3);
}
.result-items { display: flex; flex-direction: column; gap: 1px; }

.empty-state {
  display: grid;
  place-items: center;
  gap: var(--sp-3);
  padding: 56px var(--sp-6);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-md);
}
.empty-art { color: var(--brand-400); opacity: .4; }
.empty-hint { padding: var(--sp-6); text-align: center; color: var(--text-muted); font-size: var(--fs-md); }

.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-active) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------------
   Popup menus
   --------------------------------------------------------------------- */
.menu-layer { position: fixed; inset: 0; z-index: var(--z-menu); }

.menu {
  position: absolute;
  min-width: 208px;
  max-width: 290px;
  padding: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: popIn var(--t-fast) var(--ease-out);
  transform-origin: top center;
  max-height: 74vh;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: 9px var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  color: var(--text);
  text-align: start;
  transition: background var(--t-fast);
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item svg { flex: none; color: var(--text-muted); }
.menu-item:hover svg { color: var(--text); }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger svg { color: var(--danger); }
.menu-item.is-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.menu-item .item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .item-meta { font-size: var(--fs-xs); color: var(--text-faint); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-head {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.menu-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  margin-bottom: 4px;
  border-radius: var(--r-sm);
  background: var(--bg-sunken);
}
.menu-profile-text { min-width: 0; }
.menu-profile-name { font-weight: 600; font-size: var(--fs-md); color: var(--text-strong); }
.menu-profile-sub { font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------------------------------------------------------------------
   Modals
   --------------------------------------------------------------------- */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  overflow-y: auto;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 470px;
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: popIn var(--t-base) var(--ease-out);
  overflow: hidden;
}
.modal-wide { max-width: 620px; }

.modal-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { flex: 1; font-size: var(--fs-lg); font-weight: 600; color: var(--text-strong); }

.modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-5); }
.modal-body.is-flush { padding: 0; }

.modal-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
}

.modal-text { font-size: var(--fs-md); line-height: var(--lh-normal); color: var(--text); }
.modal-text strong { color: var(--text-strong); font-weight: 600; }

/* selectable user rows inside modals */
.pick-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  text-align: start;
  transition: background var(--t-fast);
  cursor: pointer;
}
.pick-row:hover { background: var(--bg-hover); }
.pick-row.is-selected { background: color-mix(in srgb, var(--brand-500) 10%, transparent); }
.pick-main { flex: 1; min-width: 0; }
.pick-name { font-weight: 600; font-size: var(--fs-md); color: var(--text-strong); }
.pick-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.pick-check {
  flex: none;
  width: 21px; height: 21px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid;
  place-items: center;
  transition: all var(--t-fast);
}
.pick-row.is-selected .pick-check {
  background: var(--bubble-out-solid);
  border-color: var(--bubble-out-solid);
  color: #fff;
}

.selected-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 var(--sp-5) var(--sp-3); }
.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 6px 0 10px;
  border-radius: var(--r-full);
  background: var(--bg-hover);
  font-size: var(--fs-sm);
  animation: popIn var(--t-fast) var(--ease-spring);
}
.selected-chip button { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; color: var(--text-muted); }
.selected-chip button:hover { background: var(--bg-active); color: var(--danger); }

/* ---------------------------------------------------------------------
   Toasts
   --------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  inset-block-end: var(--sp-5);
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: center;
  pointer-events: none;
  width: min(430px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-md);
  color: var(--text);
  pointer-events: auto;
  animation: slideUp var(--t-base) var(--ease-out);
}
.toast.is-leaving { animation: fadeOutDown var(--t-base) var(--ease-out) forwards; }
.toast-icon { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; }
.toast-body { flex: 1; min-width: 0; line-height: 1.45; }
.toast-close { flex: none; color: var(--text-faint); }
.toast-close:hover { color: var(--text); }

.toast-success .toast-icon { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.toast-error   .toast-icon { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.toast-info    .toast-icon { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }

@keyframes fadeOutDown {
  to { opacity: 0; transform: translateY(12px); }
}

/* ---------------------------------------------------------------------
   Lightbox
   --------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  background: rgba(0, 0, 0, .93);
  display: grid;
  grid-template-rows: auto 1fr;
  animation: fadeIn var(--t-base);
}
.lightbox-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  color: #fff;
}
.lightbox-head .icon-btn { color: rgba(255, 255, 255, .82); }
.lightbox-head .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.lightbox-title { flex: 1; min-width: 0; font-size: var(--fs-md); }
.lightbox-title small { display: block; font-size: var(--fs-xs); opacity: .65; }
.lightbox-stage {
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  min-height: 0;
  overflow: auto;
}
.lightbox-stage img,
.lightbox-stage video {
  max-width: 100%;
  max-height: calc(100dvh - 110px);
  border-radius: var(--r-sm);
  animation: popIn var(--t-base) var(--ease-out);
  object-fit: contain;
}

/* ---------------------------------------------------------------------
   Emoji picker
   --------------------------------------------------------------------- */
.emoji-layer { position: fixed; inset: 0; z-index: var(--z-menu); }

.emoji-panel {
  position: absolute;
  width: min(348px, calc(100vw - 24px));
  height: 340px;
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popIn var(--t-fast) var(--ease-out);
}
.emoji-tabs {
  flex: none;
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.emoji-tab {
  flex: none;
  width: 34px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  font-size: 17px;
  opacity: .55;
  transition: all var(--t-fast);
}
.emoji-tab:hover { background: var(--bg-hover); opacity: .85; }
.emoji-tab.is-active { background: var(--bg-active); opacity: 1; }

.emoji-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  align-content: start;
}
.emoji-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  font-size: 21px;
  line-height: 1;
  transition: background var(--t-fast), transform var(--t-fast);
}
.emoji-cell:hover { background: var(--bg-hover); transform: scale(1.22); }
.emoji-section-title {
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-faint);
  padding: var(--sp-2) 4px 4px;
}
