/* ===================================================================
   LANTERN COMMUNITIES — php-compat.css
   Loaded AFTER the original stylesheets. The original CSS files are NOT
   edited. This file only re-creates states that JavaScript used to toggle
   (open menus, modals, chat drawer, toast, hamburger) with pure CSS.
   =================================================================== */

/* ---------- toast (flash notice, fades out by itself) ---------- */
.toast.lc-toast.show { animation: lcToastFade 5s ease forwards; }
@keyframes lcToastFade {
  0%, 80% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100%    { opacity: 0; transform: translateX(-50%) translateY(24px); }
}

/* ---------- landing: CSS-only hamburger ---------- */
.nav-check { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.nav-toggle { user-select: none; }
.nav-check:focus-visible ~ .site-header .nav-toggle { outline: 3px solid var(--plum); outline-offset: 2px; }
.nav-check:checked ~ .site-header .mobile-nav { display: flex; }
.nav-check:checked ~ .site-header .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-check:checked ~ .site-header .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-check:checked ~ .site-header .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (min-width: 901px) { .mobile-nav, .nav-check:checked ~ .site-header .mobile-nav { display: none; } }

/* ---------- dashboard header: profile menu opened with :target ---------- */
.header-right { display: flex; align-items: center; gap: 12px; }
.profile-menu .profile-chip { color: #fff; }
.profile-menu .profile-chip:hover { background: var(--bg-ffffff-14); }
.profile-dropdown:target { display: block; }
.profile-dropdown form { margin: 0; }
.profile-dropdown .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-dismiss { display: none; position: fixed; inset: 0; z-index: 25; cursor: default; }
.profile-dropdown:target + .menu-dismiss { display: block; }
@media (max-width: 560px) {
  .profile-chip .alias { display: none; }
}

/* ---------- dashboard: modals opened with :target ---------- */
.modal-backdrop:target { display: flex; }
.modal-box { overflow-y: auto; }
.modal-box h2 { font-size: 21px; }
.modal-box .btn { margin-top: 4px; }
a.modal-close { text-decoration: none; line-height: 1; }
.modal-box h3 { font-size: 15px; margin: 18px 0 10px; }

/* ---------- dashboard: heading rows & flash ---------- */
.dash-wrap > .dash-heading-row:first-child h1 { font-size: 28px; }
.dash-wrap .hint { margin-bottom: 0; }
.chip { display: inline-block; }
.community-card .card-foot form { margin: 0; }
.card-actions { display: flex; gap: 8px; align-items: center; }
.empty-note { color: var(--ink-soft); font-size: 14px; padding: 24px; text-align: center;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- dashboard: chat drawer (server-side open) ---------- */
a.chat-backdrop { display: block; }
.chat-panel .modal-close { margin-left: auto; }
.chat-body { flex-direction: column-reverse; } /* keeps the newest message in view, no JS */
.chat-stack { display: flex; flex-direction: column; gap: 12px; }
.chat-composer { margin: 0; }
.chat-actions a { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px;
  font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); }
.chat-actions a:hover { background: var(--bg-f5f5f5); color: var(--ink); }
.chat-actions form { margin: 0; }

/* ---------- dashboard: joined-communities drawer (checkbox toggle) ---------- */
.drawer-check { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.drawer-check:checked ~ .joined-drawer { display: flex; }
.drawer-check:focus-visible ~ .messages-floating-btn { outline: 3px solid var(--plum); outline-offset: 2px; }
.joined-item { text-decoration: none; }
.joined-empty { padding: 14px 12px; font-size: 13px; color: var(--ink-soft); }
label.messages-floating-btn { user-select: none; }

/* ---------- admin: shared bits ---------- */
.admin-sidebar nav { display: block; }
.admin-sidebar-foot form { margin: 0; }
.admin-sidebar-foot button { width: 100%; }
.admin-title + .admin-sub { margin-top: 0; }
.admin-table select {
  height: 34px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--bg-ffffff); font-size: 12.5px; color: var(--ink);
}
.admin-table form { margin: 0; }
.admin-table .row-actions { align-items: center; flex-wrap: nowrap; }
.admin-table td .hint { display: block; }
.status-pill.paused { background: var(--bg-fee2e2); color: var(--fg-b91c1c); }
.status-pill.reviewed { background: var(--lavender-soft); color: var(--plum-soft); }
.chart-card + .chart-card { margin-top: 0; }
.admin-table-wrap + .admin-sub, .admin-main > .chart-empty { margin-top: 14px; }
.admin-empty { padding: 28px; text-align: center; color: var(--ink-soft); font-size: 13.5px; }
.admin-main .toast { z-index: 400; }

/* ---------- signup: native <select> sized like the compact inputs (combobox was JS) ---------- */
.compact-form .field select { padding: 9px 12px; font-size: 13.5px; }

/* ---------- landing: "Log in" inside the white mobile dropdown was white-on-white ---------- */
.site-header .mobile-nav .btn.secondary { background: transparent; border-color: var(--line); color: var(--ink); }
.site-header .mobile-nav .btn.secondary:hover { background: var(--paper); border-color: var(--plum-soft); }

/* ---------- buttons: <a> and <button> render at the same height ---------- */
.btn { line-height: 1.4; }

/* ---------- chat composer: choose file + preview ---------- */
#composer { flex-direction: column; align-items: stretch; gap: 8px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }

.attach-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 0 0 auto;
  min-width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--bg-ffffff); color: var(--plum);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.attach-btn:hover { border-color: var(--plum); background: var(--plum-solid); color: #fff; }
.attach-btn:active { transform: scale(0.94); }
.attach-btn:focus-within { border-color: var(--plum); box-shadow: 0 0 0 3px var(--rg-573258-22); }
.attach-plus {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 2.4; stroke-linecap: round;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Without JavaScript the native picker sits inside the button, so let it grow into a pill. */
.chat-composer:not(.enhanced) .attach-btn { border-radius: 11px; padding: 0 10px; }
.attach-btn input[type="file"] { font-size: 12px; max-width: 180px; font-family: var(--font-sans); }
/* With the script running, hide the native input; the card below shows the choice instead. */
.chat-composer.enhanced .attach-btn input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none;
}

.attach-card {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  background: var(--bg-ffffff); border: 1px solid var(--line); border-radius: 12px;
}
.attach-card[hidden] { display: none; }
.attach-card.has-error { border-color: var(--rose); background: var(--bg-fdf2f4); }
.attach-thumb {
  position: relative; flex: 0 0 auto; width: 56px; height: 56px;
  border-radius: 9px; overflow: hidden; background: var(--lavender-soft);
}
.attach-thumb img, .attach-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-badge {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 16px; background: var(--bg-2a2028-35);
}
.attach-info { flex: 1; min-width: 0; }
.attach-name { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { font-size: 12px; color: var(--ink-soft); }
.attach-error { font-size: 12px; color: var(--rose); margin-top: 2px; }
.attach-remove {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-ffffff); color: var(--ink-soft);
  font-size: 13px; cursor: pointer;
}
.attach-remove:hover { border-color: var(--rose); color: var(--rose); }
.attach-hint { font-size: 11px; color: var(--ink-soft); margin: 0; }
.chat-composer button[type="submit"]:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- message menu: remove photo/video, delete message ---------- */
.msg-menu { display: inline-block; position: relative; margin-left: 4px; }
.msg-menu summary {
  list-style: none; cursor: pointer; display: inline-block;
  padding: 0 6px; border-radius: 6px; font-weight: 700; color: var(--ink-soft);
}
.msg-menu summary::-webkit-details-marker { display: none; }
.msg-menu summary:hover, .msg-menu[open] summary { background: var(--lavender-soft); color: var(--plum); }
.msg-menu-list {
  position: absolute; z-index: 5; top: 20px; right: 0; min-width: 170px;
  background: var(--bg-ffffff); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lift); padding: 4px; text-align: left;
}
.chat-msg:not(.mine) .msg-menu-list { left: 0; right: auto; }
.msg-menu-list form { margin: 0; }
.msg-menu-list button, .msg-menu-list a {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  border: 0; background: none; border-radius: 7px; text-decoration: none;
  font: 13px var(--font-sans); color: var(--ink); cursor: pointer;
}
.msg-menu-list button:hover, .msg-menu-list a:hover { background: var(--paper); }
.msg-menu-list button.danger { color: var(--rose); }
.msg-menu-list button.danger:hover { background: var(--bg-fdf2f4); }

/* ---------- message times: hidden until clicked; divider after 5+ minutes ---------- */
.chat-msg .msg-time { display: none; }
.chat-msg .msg-time::before { content: "· "; }
.chat-msg.show-time .msg-time { display: inline; }
.chat-msg .bubble, .chat-msg .chat-media { cursor: pointer; }
.chat-time-divider {
  align-self: center; margin: 6px 0 2px; font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); letter-spacing: .01em;
}

/* ---------- sending / sent / failed ---------- */
.chat-msg.pending { opacity: .65; }
.chat-msg.pending.failed { opacity: 1; }
.chat-msg.pending.failed .bubble { background: var(--bg-fdf2f4); border-color: var(--rose); color: var(--ink); }
.pending-media {
  padding: 8px 12px; margin-bottom: 4px; border: 1px dashed var(--line); border-radius: 12px;
  background: var(--bg-ffffff); font-size: 12.5px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; margin-left: auto;
}
.msg-status {
  display: flex; justify-content: flex-end; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 3px; font-size: 11px; color: var(--ink-soft);
}
.chat-msg:not(.mine) .msg-status { justify-content: flex-start; }
.msg-status.sent { color: var(--sage); }
.msg-spinner {
  display: none; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--plum);
  animation: lcSpin .8s linear infinite;
}
.msg-status.spinning .msg-spinner { display: inline-block; }
.chat-msg.slow .msg-status { color: var(--marigold-dark); }
@keyframes lcSpin { to { transform: rotate(360deg); } }
.chat-msg.failed .msg-status { color: var(--rose); font-weight: 600; }
.msg-retry, .msg-discard {
  border: 1px solid var(--line); background: var(--bg-ffffff); border-radius: 999px; padding: 2px 9px;
  font: 600 11px var(--font-sans); cursor: pointer; color: var(--plum);
}
.msg-retry:hover { border-color: var(--plum); }
.msg-discard { color: var(--ink-soft); }
.msg-discard:hover { border-color: var(--rose); color: var(--rose); }
@media (prefers-reduced-motion: reduce) { .msg-spinner { animation-duration: 2s; } }

/* ---------- edited label + edit box ---------- */
.msg-edited { font-style: italic; }
.msg-edit-form {
  background: var(--bg-ffffff); border: 1.5px solid var(--plum); border-radius: 14px; padding: 8px;
  box-shadow: 0 0 0 3px var(--rg-573258-12); min-width: 240px;
}
.msg-edit-form textarea {
  width: 100%; min-height: 60px; resize: vertical; border: 0; outline: none;
  font: 13.5px/1.5 var(--font-sans); color: var(--ink); background: transparent;
}
.msg-edit-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 4px; }
.msg-edit-actions .btn { padding: 6px 14px; font-size: 13px; }
.msg-edit-cancel { font-size: 13px; color: var(--ink-soft); text-decoration: none; }
.msg-edit-cancel:hover { color: var(--plum); text-decoration: underline; }

/* ---------- reply quote (on a message) + reply bar (in the composer) ---------- */
.reply-quote {
  display: block; max-width: 100%; margin-bottom: 4px; padding: 5px 10px;
  border-left: 3px solid var(--plum-soft); border-radius: 8px;
  background: var(--lavender-soft); color: var(--ink-soft);
  font-size: 12px; line-height: 1.4; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reply-quote b { color: var(--plum); margin-right: 4px; }
.reply-quote:hover { background: var(--bg-e3d9e3); }
.chat-msg.mine .reply-quote { margin-left: auto; }
.chat-msg:target .bubble { box-shadow: 0 0 0 3px var(--rg-d9694e-35); }   /* highlight when jumped to */

.reply-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-left: 3px solid var(--plum); border-radius: 10px; background: var(--lavender-soft);
}
.reply-bar-info { flex: 1; min-width: 0; }
.reply-bar-label { font-size: 12px; color: var(--ink-soft); }
.reply-bar-label b { color: var(--plum); }
.reply-bar-text { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar .attach-remove { display: grid; place-items: center; text-decoration: none; }

/* ---------- reactions ---------- */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chat-msg.mine .msg-reactions { justify-content: flex-end; }
.msg-reactions form { margin: 0; }
.reaction-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg-ffffff);
  font: 13px var(--font-sans); color: var(--ink); cursor: pointer; line-height: 1.5;
}
.reaction-chip span { font-size: 12px; color: var(--ink-soft); }
.reaction-chip:hover { border-color: var(--plum-soft); }
.reaction-chip.reacted { background: var(--lavender-soft); border-color: var(--plum-soft); }
.reaction-chip.reacted span { color: var(--plum); font-weight: 700; }

/* ---------- reply / react buttons under each message ---------- */
.msg-actions {
  display: flex; gap: 12px; margin-top: 3px; font-size: 12px;
  opacity: .55; transition: opacity .15s;
}
.chat-msg:hover .msg-actions, .msg-actions:focus-within, .react-picker[open] { opacity: 1; }
.chat-msg.mine .msg-actions { justify-content: flex-end; }
.msg-actions a, .react-picker summary {
  color: var(--ink-soft); text-decoration: none; cursor: pointer; list-style: none;
}
.msg-actions a:hover, .react-picker summary:hover { color: var(--plum); }
.react-picker { position: relative; }
.react-picker summary::-webkit-details-marker { display: none; }
.react-picker-list {
  position: absolute; z-index: 5; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 2px; padding: 4px; margin: 0;
  background: var(--bg-ffffff); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lift);
}
.react-picker-list button {
  width: 34px; height: 34px; border: 0; border-radius: 50%; background: none;
  font-size: 18px; cursor: pointer; transition: transform .12s, background .12s;
}
.react-picker-list button:hover { background: var(--paper); transform: scale(1.2); }

/* ---------- report a message ---------- */
.report-picker { position: relative; }
.report-picker summary { color: var(--ink-soft); cursor: pointer; list-style: none; }
.report-picker summary::-webkit-details-marker { display: none; }
.report-picker summary:hover, .report-picker[open] summary { color: var(--rose); }
.report-picker[open] { opacity: 1; }
.report-form {
  position: absolute; z-index: 6; bottom: 22px; left: 0; width: 250px; margin: 0;
  display: flex; flex-direction: column; gap: 4px; padding: 12px;
  background: var(--bg-ffffff); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lift);
}
.report-form-title { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.report-form-sub { font-size: 11.5px; color: var(--ink-soft); margin: 0 0 4px; line-height: 1.4; }
.report-option {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 7px;
  font-size: 13px; color: var(--ink); cursor: pointer;
}
.report-option:hover { background: var(--paper); }
.report-option input { accent-color: var(--rose); }
.report-form textarea {
  margin-top: 4px; padding: 7px 9px; border: 1.5px solid var(--line); border-radius: 9px; resize: vertical;
  font: 12.5px var(--font-sans);
}
.report-form textarea:focus { outline: none; border-color: var(--plum); }
.report-form .btn { margin-top: 4px; padding: 7px 12px; font-size: 13px; }

.chat-media {
  display: block; max-width: 100%; max-height: 260px; border-radius: 12px;
  border: 1px solid var(--line); margin-bottom: 6px; background: var(--bg-000000);
}
.chat-msg.mine .chat-media { margin-left: auto; }
.sensitive-media {
  background: var(--bg-ffffff); border: 1px dashed var(--line); border-radius: 12px;
  padding: 8px 12px; margin-bottom: 6px; font-size: 13px;
}
.sensitive-media summary { cursor: pointer; font-weight: 600; color: var(--plum-soft); }
.sensitive-media[open] summary { margin-bottom: 8px; }

/* ---------- toast colours: green = success, red = error (success auto-hides after ~4s) ---------- */
.lc-toast.success { background: var(--bg-2f6b4f); color: #fff; }
.lc-toast.error { background: var(--bg-a33b50); color: #fff; }
.toast.lc-toast.success.show { animation: lcToastFade 4s ease forwards, lcToastUp 300ms var(--ease-out, ease-out); }

/* ---------- moderation notices at the top of the page: yellow = warning, red = ban ---------- */
.mod-notices { position: relative; z-index: 120; display: flex; flex-direction: column; }
.mod-notice { padding: 12px 20px; font-size: 14px; font-weight: 600; text-align: center; border-bottom: 1px solid var(--ln-000000-6); }
.mod-notice.warning { background: var(--bg-fef3c7); color: var(--fg-92400e); }
.mod-notice.ban { background: var(--bg-fee2e2); color: var(--fg-b91c1c); }

/* ---------- banned screen ---------- */
.banned-card {
  max-width: 460px; margin: 10vh auto 0; padding: 32px 28px; text-align: center;
  background: var(--bg-ffffff); border: 1.5px solid var(--ln-f3b7c2); border-radius: 18px; box-shadow: 0 12px 32px var(--sh-a33b50-12);
}
.banned-icon { font-size: 34px; margin-bottom: 8px; }
.banned-card h1 { color: var(--fg-b91c1c); font-size: 24px; margin-bottom: 10px; }
.banned-text { font-size: 15px; font-weight: 600; color: var(--fg-7f1d1d); background: var(--bg-fee2e2); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.banned-sub { font-size: 13px; color: var(--ink-soft, var(--fg-635760)); margin-bottom: 18px; }

/* ---------- Help & appeals (member side) ---------- */
.help-shell { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.help-card { background: var(--bg-ffffff); border: 1px solid var(--line, var(--ln-e7dad8)); border-radius: 18px; padding: 24px; box-shadow: 0 4px 20px var(--sh-573258-6); }
.help-card h1 { font-size: 24px; margin-bottom: 4px; }
.help-card h2 { font-size: 18px; margin-bottom: 12px; }
.help-card select, .help-card textarea, .help-card input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line, var(--ln-e7dad8)); border-radius: 10px; font: 14px inherit; background: var(--bg-ffffff);
}
.help-card textarea { resize: vertical; }
.help-item { border: 1px solid var(--line, var(--ln-e7dad8)); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.help-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.help-meta { font-size: 12px; color: var(--ink-soft, var(--fg-635760)); margin-left: auto; }
.help-body { margin: 8px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.help-status { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.help-status.open { background: var(--bg-fef3c7); color: var(--fg-92400e); }
.help-status.replied { background: var(--bg-e5ece7); color: var(--fg-2f6b4f); }
.help-status.closed { background: var(--bg-f1f5f9); color: var(--fg-475569); }
.help-reply { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--ln-5e7a6c); background: var(--bg-f3f7f4); border-radius: 0 10px 10px 0; }
.help-reply-label { font-size: 11.5px; font-weight: 700; color: var(--fg-2f6b4f); margin-bottom: 4px; }
.help-reply p { margin: 0; font-size: 14px; white-space: pre-wrap; }
.help-empty { color: var(--ink-soft, var(--fg-635760)); font-size: 14px; }
.banned-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.banned-logout { margin-top: 14px; }
.link-button { background: none; border: 0; color: var(--ink-soft, var(--fg-635760)); font: 600 13px inherit; text-decoration: underline; cursor: pointer; }
.mod-notice.info { background: var(--bg-e5ece7); color: var(--fg-2f6b4f); }

/* ---------- 4th-flag warning modal (centered, dimmed backdrop, only the button closes it) ---------- */
.warn-modal-backdrop {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px;
  background: var(--bg-2a2028-55);
}
.warn-modal-backdrop[hidden] { display: none; }
.warn-modal {
  width: min(420px, 100%); padding: 28px 24px 22px; text-align: center;
  background: var(--bg-ffffff); border-radius: 18px; border-top: 6px solid var(--ln-f59e0b); box-shadow: 0 20px 50px var(--sh-000000-25);
  animation: lcPopIn 200ms ease-out;
}
.warn-modal-icon { font-size: 36px; margin-bottom: 6px; }
.warn-modal h2 { color: var(--fg-92400e); font-size: 22px; margin: 0 0 8px; }
.warn-modal p { color: var(--fg-2a2028); font-size: 15px; line-height: 1.55; margin: 0 0 20px; background: var(--bg-fef3c7); border-radius: 10px; padding: 12px 14px; }
.warn-modal form { margin: 0; }
.warn-modal .btn { width: 100%; min-height: 46px; }

/* ---------- shared confirm modal (ban / remove / lift ban / delete) ---------- */
.confirm-backdrop { position: fixed; inset: 0; z-index: 320; display: grid; place-items: center; padding: 16px; background: var(--bg-2a2028-55); }
.confirm-backdrop[hidden] { display: none; }
.confirm-box {
  width: min(420px, 100%); padding: 24px 22px 20px; background: var(--bg-ffffff); border-radius: 18px;
  box-shadow: 0 20px 50px var(--sh-000000-25); animation: lcPopIn 180ms ease-out;
}
.confirm-box h2 { font-size: 19px; margin: 0 0 8px; color: var(--fg-2a2028); overflow-wrap: anywhere; }
.confirm-box p { font-size: 14px; line-height: 1.5; color: var(--fg-635760); margin: 0 0 14px; }
.confirm-reason { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--fg-2a2028); }
.confirm-reason small { font-weight: 400; color: var(--fg-635760); }
.confirm-reason textarea { width: 100%; padding: 8px 10px; border: 1.5px solid var(--ln-e7dad8); border-radius: 10px; font: 13.5px inherit; resize: vertical; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.confirm-actions .btn { min-height: 42px; padding: 0 18px; }
.btn.confirm-danger { background: var(--bg-a33b50); border-color: var(--ln-a33b50); color: #fff; }
.btn.confirm-danger:hover { background: var(--bg-8e2f43); }
.btn.confirm-safe { background: var(--bg-2f6b4f); border-color: var(--ln-2f6b4f); color: #fff; }
.btn.confirm-safe:hover { background: var(--bg-255840); }
.confirm-actions .btn:disabled { opacity: .6; cursor: wait; }
@media (max-width: 420px) { .confirm-actions .btn { flex: 1; } }

/* ============================== community picker ============================== */
.picker-search { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.picker-search input[type="search"], .picker-search select {
  height: 40px; padding: 0 14px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font: 14px var(--font-sans);
}
.picker-search input[type="search"] { flex: 1 1 220px; min-width: 0; }
.picker-search select { flex: 0 1 180px; min-width: 0; }
.picker-search input:focus, .picker-search select:focus { outline: none; border-color: var(--plum); box-shadow: 0 0 0 3px var(--rg-573258-22); }
.picker-search .btn { height: 40px; }
.discover-heading { margin-top: 30px; }
.community-card .desc { flex: none; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.community-card .card-foot { margin-top: auto; }
.community-card.joined { border-color: var(--plum-soft); }
.community-card .match-tag.joined-tag { background: var(--mint-soft); color: var(--sage); }
.community-card .match-tag.banned-tag { background: var(--bg-fee2e2); color: var(--fg-b91c1c); }
.badge.paused { background: var(--danger-soft); color: var(--rose); }
.empty-note a { color: var(--plum); font-weight: 700; text-decoration: underline; }
.picker-pages { margin-top: 18px; }
.chip:focus-visible, .community-card .btn:focus-visible, .picker-search .btn:focus-visible, .empty-note a:focus-visible {
  outline: 3px solid var(--marigold); outline-offset: 2px;
}

/* ============================== chat: sidebar + main ============================== */
.chat-panel { height: 100dvh; }
.chat-panel.has-sidebar { max-width: 980px; flex-direction: row; }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-sidebar {
  width: 280px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  background: var(--paper); border-right: 1px solid var(--line);
}
.chat-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px; }
.chat-sidebar-head h2 { margin: 0; font-size: 15px; color: var(--plum); }
.chat-sidebar ul { list-style: none; margin: 0; padding: 0 8px 14px; overflow-y: auto; flex: 1; }
.chat-sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px;
  color: var(--ink); text-decoration: none; min-height: 56px;
}
.chat-sidebar-item:hover { background: var(--lavender-soft); }
.chat-sidebar-item.current { background: var(--lavender-soft); box-shadow: inset 3px 0 0 var(--marigold); }
.chat-sidebar-icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--card); box-shadow: 0 0 0 1px var(--line) inset;
}
.chat-sidebar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-sidebar-name, .chat-sidebar-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sidebar-name { font-weight: 700; font-size: 13.5px; }
.chat-sidebar-preview { font-size: 12px; color: var(--ink-soft); }
.chat-unread {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--plum-solid); color: #fff; font-size: 11px; font-weight: 700;
}
.chat-unread[hidden] { display: none; }
.chat-sidebar-open, .chat-sidebar-close, .chat-sidebar-scrim { display: none; }
.chat-sidebar-open, .chat-sidebar-close {
  position: relative; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; cursor: pointer;
  align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: var(--plum);
}
.chat-sidebar-open:hover, .chat-sidebar-close:hover { background: var(--lavender-soft); }
.chat-sidebar-open .chat-unread { position: absolute; top: -2px; right: -6px; }
.chat-head-info { flex: 1; min-width: 0; }
.chat-head h2.chat-title { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
  .chat-panel.has-sidebar { flex-direction: column; }
  .chat-sidebar {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 6; width: min(300px, 86vw);
    transform: translateX(-105%); transition: transform .25s var(--ease-out); box-shadow: 12px 0 40px var(--sh-573258-12);
  }
  .chat-sidebar-check:checked ~ .chat-sidebar { transform: none; }
  .chat-sidebar-check:checked ~ .chat-sidebar-scrim { display: block; position: absolute; inset: 0; z-index: 5; background: var(--bg-2a2028-50); }
  .chat-sidebar-open, .chat-sidebar-close { display: inline-flex; }
  .chat-head { padding: 12px 12px 12px 8px; gap: 6px; }
}

/* ============================== chat: messages ============================== */
.chat-msg .meta { display: flex; align-items: center; gap: 6px; }
.chat-msg.mine .meta { justify-content: flex-end; }
.chat-msg .msg-time { display: inline; font-weight: 500; }
.chat-msg .msg-time::before { content: none; }
.msg-avatar {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--plum-solid); color: #fff; font-size: 11px; font-weight: 700;
}
.chat-msg.grouped { margin-top: -8px; }
.chat-msg.grouped .meta > b, .chat-msg.grouped .meta > .msg-avatar, .chat-msg.grouped .meta > .msg-time,
.chat-msg.grouped .meta > .profile-trigger { display: none; }
/* Grouped: no name row; the ⋯ menu floats beside the bubble and appears on hover / keyboard focus. */
.chat-msg { position: relative; }
.chat-msg.grouped .meta { position: absolute; top: 6px; margin: 0; z-index: 2; opacity: 0; transition: opacity .15s; }
.chat-msg.grouped:not(.mine) .meta { left: 100%; padding-left: 4px; }
.chat-msg.grouped.mine .meta { right: 100%; padding-right: 4px; }
.chat-msg.grouped:hover .meta, .chat-msg.grouped .meta:focus-within, .chat-msg.grouped .meta:has(details[open]) { opacity: 1; }
.chat-msg:not(.mine):not(.typing) .bubble, .chat-msg:not(.mine) .reply-quote,
.chat-msg:not(.mine) .msg-actions, .chat-msg:not(.mine) .msg-reactions { margin-left: 28px; }
.chat-msg.removed .bubble, .chat-msg.mine.removed .bubble {
  background: transparent; border: 1px dashed var(--line); color: var(--ink-soft); cursor: default;
}
.chat-time-divider {
  display: flex; align-items: center; gap: 10px; align-self: stretch; margin: 10px 0 4px;
}
.chat-time-divider::before, .chat-time-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chat-older { display: flex; justify-content: center; padding: 2px 0 6px; }
.chat-jump-wrap { position: relative; height: 0; }
.chat-jump {
  position: absolute; right: 18px; bottom: 12px; z-index: 3; border: 0; border-radius: 20px; padding: 9px 15px;
  background: var(--plum-solid); color: #fff; font: 700 12.5px var(--font-sans); cursor: pointer; box-shadow: var(--shadow-lift);
}
.chat-jump:hover { filter: brightness(1.1); }
.msg-menu-list .report-picker summary { display: block; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.msg-menu-list .report-picker summary:hover { background: var(--paper); }
.msg-menu-list .report-form { position: static; width: 240px; box-shadow: none; border: 0; padding: 4px 6px 6px; }
.composer-alert {
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; padding: 10px 12px; border-radius: 11px;
  background: var(--danger-soft); border: 1px solid var(--rose); color: var(--ink); font-size: 13px; line-height: 1.45;
}
.composer-alert[hidden] { display: none; }
.composer-alert-text { flex: 1; }
.chat-composer[aria-busy="true"] button[type="submit"] { cursor: progress; }
.composer-alert { margin: 8px 0 0; align-items: center; }
.composer-alert .composer-retry { margin: 0; padding: 5px 12px; }
.reply-bar[hidden] { display: none; }

/* ---------- community audience ("Who can join") ---------- */
.audience-fields { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; margin: 4px 0 14px; min-width: 0; }
.audience-fields legend { padding: 0 6px; font-weight: 700; font-size: 13.5px; color: var(--plum); }
.audience-fields legend small { font-weight: 500; color: var(--ink-soft); }
.audience-fields .hint { margin: 0 0 10px; }
.audience-fields:has(select[name="audience_location_type"] option[value="anywhere"]:checked) .audience-location { display: none; }
.audience-fields .checkbox-row { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; color: var(--ink); }
.audience-fields select, .audience-fields input:not([type="checkbox"]) { width: 100%; }
.badge.audience { background: var(--bg-fcefd8); color: var(--marigold-dark); }
.join-note { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
.join-note a, .chat-join-bar a { color: var(--plum); font-weight: 700; text-decoration: underline; }
.chat-join-bar { align-items: center; justify-content: space-between; }
.chat-join-bar form { margin: 0; }
.settings-section { padding: 6px 0 14px; border-bottom: 1px solid var(--line); }
.settings-section:last-child { border-bottom: 0; }
.settings-section h3 { font-size: 14px; color: var(--plum); margin: 14px 0 8px; }
.settings-form .btn { margin-top: 4px; }
.request-actions { display: flex; gap: 6px; flex-shrink: 0; }
.request-actions form { margin: 0; }
.btn-soft.danger { color: var(--rose); }
.chat-menu-card .chat-unread { margin-left: 6px; }
.settings-info { margin: 0 0 8px; padding: 9px 12px; border-radius: 10px; font-size: 13px; background: var(--lavender-soft); color: var(--ink); }
.audience-log { list-style: none; margin: 0; padding: 6px 10px; max-height: 210px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); font-size: 12.5px; color: var(--ink); }
.audience-log li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.audience-log li:last-child { border-bottom: 0; }
.audience-log-meta { font-size: 11.5px; color: var(--ink-soft); margin-bottom: 2px; }
.audience-log:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

/* ---------- profile popup ---------- */
.profile-trigger {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; margin: 0; border: 0; background: none;
  font: inherit; color: inherit; cursor: pointer; border-radius: 8px;
}
.profile-trigger:hover b, .member-name .profile-trigger:hover { text-decoration: underline; }
.profile-trigger:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.member-row .profile-trigger.member-avatar { justify-content: center; font-weight: 700; }
.member-name .profile-trigger { font-weight: inherit; }
.profile-card-box { max-width: 380px; }
.profile-card-box .modal-head { justify-content: flex-end; margin-bottom: 0; }
.profile-card-box:focus { outline: none; }
.profile-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile-card-head h2 { margin: 0; font-size: 20px; color: var(--plum); overflow-wrap: anywhere; }
.profile-card-avatar {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--plum-solid); color: #fff; font-size: 24px; font-weight: 700;
}
.profile-card-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.profile-card-facts { margin: 0 0 12px; display: grid; gap: 8px; }
.profile-card-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 10px; background: var(--lavender-soft); }
.profile-card-facts dt { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.profile-card-facts dd { margin: 0; font-size: 13.5px; color: var(--ink); font-weight: 700; text-align: right; }
.profile-card-note { font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; }
.profile-card-actions { display: flex; gap: 8px; justify-content: flex-end; }
.member-badge.role-owner { background: var(--bg-fcefd8); color: var(--marigold-dark); }
.member-badge.role-moderator { background: var(--mint-soft); color: var(--sage); }
.member-actions summary { white-space: nowrap; }
.member-actions.role-menu { margin-left: auto; flex-shrink: 0; }
.member-actions.role-menu > summary {
  width: auto; height: auto; min-height: 34px; padding: 6px 12px; display: inline-flex; align-items: center;
  font-size: 12.5px; font-weight: 700; border: 1px solid var(--line); border-radius: 9px; color: var(--plum);
}
.settings-section h3 small { font-weight: 500; }
.member-badge.mismatch { background: var(--bg-fee2e2); color: var(--fg-b91c1c); }
.private-details { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.private-details b { color: var(--ink); font-weight: 600; }

/* ---------- media: chat thumbnails, gallery, lightbox ---------- */
.media-open {
  position: relative; display: block; padding: 0; margin: 0; border: 0; background: none; cursor: zoom-in;
  border-radius: 12px; max-width: 100%; color: inherit; font: inherit; text-align: left;
}
.chat-msg.mine .media-open { margin-left: auto; }
.media-open:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.media-open .chat-media { display: block; pointer-events: none; }
.media-open .media-play {
  position: absolute; inset: 0; margin: auto; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; background: rgba(0,0,0,.55); color: #fff; font-size: 18px; pointer-events: none;
}
.media-locked { display: block; padding: 14px 16px; border-radius: 12px; border: 1px dashed var(--line); color: var(--ink-soft); font-size: 13px; }
.media-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.media-filters .filter-chips { gap: 6px; }
.media-filters .chip { font: 600 12.5px var(--font-sans); padding: 6px 12px; }
.media-filters select { height: 34px; padding: 0 10px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: 13px var(--font-sans); max-width: 100%; }
.media-grid .media-open.media-tile { width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: var(--lavender-soft); }
.media-grid .media-open.media-tile .chat-media { width: 100%; height: 100%; max-height: none; object-fit: cover; border-radius: 0; }
.media-tile-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; display: flex; flex-direction: column; gap: 1px;
  font-size: 11px; line-height: 1.3; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.75));
  opacity: 0; transition: opacity .15s; pointer-events: none; text-align: left;
}
.media-tile-meta b { font-size: 11.5px; }
.media-open.media-tile:hover .media-tile-meta, .media-open.media-tile:focus-visible .media-tile-meta { opacity: 1; }
@media (hover: none), (max-width: 600px) { .media-tile-meta { opacity: 1; } }
.media-tile-wrap > summary { font-size: 12px; }

.lightbox {
  position: fixed; inset: 0; z-index: 600; display: flex; flex-direction: column;
  background: rgba(10, 7, 11, .95); color: #fff;
}
.lightbox[hidden] { display: none; }
body.lightbox-open { overflow: hidden; }
.lightbox-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: 64px; }
.lightbox-avatar {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--plum-solid); color: #fff; font-weight: 700;
}
.lightbox-who { display: flex; flex-direction: column; min-width: 0; }
.lightbox-who b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox-who time { font-size: 12.5px; color: rgba(255,255,255,.78); cursor: help; }
.lightbox-count { margin-left: auto; font-size: 13px; color: rgba(255,255,255,.78); white-space: nowrap; }
.lightbox-close {
  width: 48px; height: 48px; flex-shrink: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.12);
  color: #fff; font-size: 30px; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.22); }
.lightbox-body { flex: 1; min-height: 0; display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.lightbox-stage { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; justify-content: center; }
.lightbox-media { max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 8px; background: #000; }
.lightbox-msg { color: rgba(255,255,255,.85); font-size: 14px; text-align: center; padding: 20px; }
.lightbox-nav {
  width: 48px; height: 48px; flex-shrink: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.12);
  color: #fff; font-size: 30px; line-height: 1; cursor: pointer;
}
.lightbox-nav:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.lightbox-nav:disabled { opacity: .25; cursor: default; }
.lightbox-close:focus-visible, .lightbox-nav:focus-visible, .lightbox-reveal:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
.lightbox-caption {
  margin: 0; padding: 10px 16px 16px; max-height: 22vh; overflow-y: auto; text-align: center;
  font-size: 14px; line-height: 1.5; color: rgba(255,255,255,.92); white-space: pre-wrap; overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .lightbox-body { padding: 0; gap: 0; position: relative; }
  .lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 40px; height: 40px; background: rgba(0,0,0,.45); }
  .lightbox-nav.prev { left: 6px; }
  .lightbox-nav.next { right: 6px; }
  .lightbox-media { border-radius: 0; max-height: calc(100dvh - 140px); }
}

/* switching communities: small loading state over the panel */
.chat-main { position: relative; }
.chat-loading {
  position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center;
  background: var(--bg-2a2028-25); animation: lcFadeIn .15s ease-out both;
}
.chat-loading span {
  padding: 10px 18px; border-radius: 20px; background: var(--card); color: var(--ink);
  font-size: 13px; font-weight: 700; box-shadow: var(--shadow-lift);
}
@keyframes lcFadeIn { from { opacity: 0; } to { opacity: 1; } }
.chat-sidebar-item:focus-visible, .chat-sidebar-open:focus-visible, .chat-sidebar-close:focus-visible,
.chat-jump:focus-visible, .msg-menu summary:focus-visible, .chat-older .btn:focus-visible, .composer-alert button:focus-visible {
  outline: 3px solid var(--marigold); outline-offset: 2px;
}
.chat-body:focus-visible { outline: 3px solid var(--marigold); outline-offset: -3px; }
