.community-tab { position: relative; display: none; }
.community-tab.visible { display: flex; }
.community-tab .community-unread {
  position: absolute; top: 5px; inset-inline-end: calc(50% - 18px);
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: #ef4444; color: #fff; font-size: 9px; font-weight: 700;
  align-items: center; justify-content: center; line-height: 15px;
}
.community-tab .community-unread[hidden] { display: none; }
.v4-tabbar.community-enabled { grid-template-columns: repeat(5, 1fr); }
.v4-tabbar.community-enabled .v4-tab { min-width: 0; }

#v4SheetCommunity {
  height: min(94vh, 920px); max-height: calc(100dvh - 14px); overflow: hidden;
  border-radius: 26px 26px 0 0;
}
#v4SheetCommunity.open { display: flex; flex-direction: column; }
#v4SheetCommunity .v4-sheet-handle { width: 42px; height: 5px; margin: 9px auto 3px; background: #dce8f2; }
#v4SheetCommunity .v4-sheet-header {
  flex: 0 0 auto; min-height: 60px; padding: 8px 22px 13px; border-bottom: 1px solid #e4edf5; background: #fff;
}
#v4SheetCommunity .v4-sheet-body { flex: 1 1 auto; min-height: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.community-sheet-title, .community-header-actions, .community-card-tools {
  display: flex; align-items: center;
}
.community-sheet-title { min-width: 0; gap: 9px; }
.community-sheet-title h3 { letter-spacing: 0; white-space: nowrap; }
.community-member-count {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-radius: 999px; background: #e8f4ff; color: #0068ad; padding: 4px 9px;
  font-size: 11px; font-weight: 750; line-height: 1.2;
}
.community-member-count[hidden] { display: none; }
.community-header-actions { gap: 7px; }
.community-shell {
  height: 100%; min-height: 0; display: flex; flex-direction: column;
  color: #172033; background: #edf7ff; letter-spacing: 0;
}
.community-toolbar {
  flex: 0 0 auto; padding: 14px 22px 12px; background: #edf7ff;
  display: grid; gap: 11px;
}
.community-segments {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  min-height: 44px; background: #deeffd; padding: 4px; border-radius: 999px;
}
.community-segment {
  min-width: 0; border: 0; border-radius: 999px; background: transparent; color: #526881;
  padding: 8px 10px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.community-segment:hover { color: #005ca8; }
.community-segment.active { background: #fff; color: #005ca8; box-shadow: 0 2px 7px rgba(38, 85, 121, .12); }
.community-search-wrap {
  box-sizing: border-box; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 9px;
  border: 1px solid #d3e0ea; border-radius: 999px; background: #fff; color: #6b7f94; padding: 0 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.community-search-wrap:focus-within { border-color: #55b9dc; box-shadow: 0 0 0 3px rgba(2, 159, 211, .11); }
.community-search-wrap > .community-svg { width: 17px; height: 17px; flex: 0 0 17px; }
.community-search {
  width: 100%; min-width: 0; height: 42px; border: 0; outline: 0; background: transparent;
  color: #172033; font: inherit; font-size: 13px; padding: 0;
}
.community-search::placeholder { color: #8a99aa; }
.community-topic-strip {
  display: flex; gap: 7px; overflow-x: auto; overscroll-behavior-inline: contain;
  padding: 0 1px 2px; scrollbar-width: none;
}
.community-topic-strip::-webkit-scrollbar { display: none; }
.community-topic-filter {
  flex: 0 0 auto; min-height: 35px; border: 1px solid #d7e2eb; border-radius: 999px;
  background: #fff; color: #34465a; padding: 7px 13px; font: inherit; font-size: 11.5px;
  font-weight: 700; cursor: pointer; white-space: nowrap;
}
.community-topic-filter:hover { border-color: #87cae3; color: #005ca8; }
.community-topic-filter.active { border-color: #0076bb; background: #0076bb; color: #fff; box-shadow: 0 2px 6px rgba(0, 92, 168, .18); }
.community-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 2px 22px 30px; scroll-padding-bottom: 30px; background: #edf7ff;
}
.community-compose, .community-card, .community-panel, .community-gate {
  box-sizing: border-box; background: #fff; border: 1px solid #e4edf4; border-radius: 8px;
}
.community-compose { padding: 14px; margin-bottom: 14px; box-shadow: 0 7px 20px rgba(30, 75, 105, .07); }
.community-compose-title { font-size: 14px; font-weight: 750; }
.community-compose-toggle {
  box-sizing: border-box; width: 100%; min-height: 62px; margin-bottom: 14px; padding: 9px 12px;
  border: 1px solid #e5edf3; border-radius: 8px; background: #fff; color: #334155;
  display: flex; align-items: center; gap: 11px; font: inherit; text-align: start; cursor: pointer;
  box-shadow: 0 7px 20px rgba(30, 75, 105, .07);
}
.community-compose-toggle:hover { border-color: #8bd4ea; color: #005ca8; }
.community-compose-toggle .community-avatar { width: 38px; height: 38px; flex-basis: 38px; }
.community-compose-prompt {
  min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #738397; font-size: 13px; font-weight: 550;
}
.community-compose-plus {
  width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center;
  border-radius: 50%; background: #0076bb; color: #fff; box-shadow: 0 4px 10px rgba(0, 92, 168, .24);
}
.community-compose-plus .community-svg { width: 19px; height: 19px; }
.community-compose-close {
  width: 30px; height: 30px; border: 0; border-radius: 50%; background: #eef5fa;
  color: #526881; font-size: 19px; cursor: pointer;
}
.community-compose > .community-textarea { margin-top: 10px; }
.community-topic-grid { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.community-topic-choice {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px;
  border: 1px solid #cbd5e1; border-radius: 999px; font-size: 11px; cursor: pointer;
}
.community-topic-choice:has(input:checked) { border-color: #029fd3; background: #e9f8fd; color: #005ca8; }
.community-select, .community-input, .community-textarea {
  box-sizing: border-box; width: 100%; border: 1px solid #cbd5e1; background: #fff; color: #1e293b;
  border-radius: 7px; font: inherit; font-size: 13px; padding: 9px 11px; outline: none;
}
.community-select:focus, .community-input:focus, .community-textarea:focus {
  border-color: #029fd3; box-shadow: 0 0 0 3px rgba(2, 159, 211, .11);
}
.community-textarea { min-height: 92px; resize: vertical; line-height: 1.5; }

.community-card {
  position: relative; padding: 17px 19px 14px; margin-bottom: 13px; border-color: #e8eef3;
  box-shadow: 0 7px 22px rgba(30, 75, 105, .075);
}
.community-card.pinned { border-inline-start: 3px solid #f59e0b; }
.community-card.tombstone { background: #f8fafc; border-style: dashed; box-shadow: none; }
.community-card.tombstone .community-body { color: #64748b; font-style: italic; }
.community-card.reply { margin-inline-start: 18px; border-inline-start: 2px solid #b9dff4; }
.community-card.reply.depth-2 { margin-inline-start: 36px; }
.community-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.community-replying-to { margin: 8px 0 0; font-weight: 650; }
.community-author { display: flex; gap: 11px; align-items: center; min-width: 0; flex: 1; }
.community-avatar {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; display: grid; place-items: center;
  background: #e0f2fe; color: #0369a1; font-weight: 750; font-size: 12px; border: 1px solid #bae6fd;
}
.community-avatar[data-avatar="leaf"] { background:#dcfce7;color:#15803d;border-color:#bbf7d0; }
.community-avatar[data-avatar="sun"] { background:#fef3c7;color:#b45309;border-color:#fde68a; }
.community-avatar[data-avatar="mountain"] { background:#e2e8f0;color:#475569;border-color:#cbd5e1; }
.community-avatar[data-avatar="spark"] { background:#f3e8ff;color:#7e22ce;border-color:#e9d5ff; }
.community-avatar[data-avatar="wave"] { background:#cffafe;color:#0e7490;border-color:#a5f3fc; }
.community-avatar[data-avatar="compass"] { background:#fee2e2;color:#b91c1c;border-color:#fecaca; }
.community-avatar-symbol { font-size: 19px; line-height: 1; filter: saturate(.78); }
.community-author-button {
  min-width: 0; max-width: 100%; border: 0; background: none; padding: 0; text-align: start;
  color: inherit; font: inherit; cursor: pointer;
}
.community-author-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.community-author-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 750; }
.community-meta { color: #667b91; font-size: 10.5px; margin-top: 3px; }
.community-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.58; margin: 15px 0 13px; color: #172033; }
.community-topics { display: flex; gap: 5px; flex-wrap: wrap; }
.community-topic {
  display: inline-flex; align-items: center; min-height: 21px; border-radius: 999px;
  background: #eef5fa; color: #526881; padding: 3px 7px; font-size: 9.5px; font-weight: 700;
}
.community-topic.official { background: #eee9ff; color: #6d4bc3; }
.community-pinned-badge {
  display: inline-flex; align-items: center; gap: 4px; color: #9a6500; background: #fff7d6;
  border-radius: 999px; padding: 4px 7px; font-size: 9.5px; font-weight: 750;
}
.community-pinned-badge .community-svg { width: 12px; height: 12px; }
.community-card-tools { flex: 0 0 auto; gap: 6px; }
.community-post-menu-wrap { position: relative; }
.community-more-button {
  width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #526881;
  display: grid; place-items: center; cursor: pointer;
}
.community-more-button:hover, .community-more-button[aria-expanded="true"] { background: #eef5fa; color: #005ca8; }
.community-more-button .community-svg { width: 18px; height: 18px; }
.community-post-menu {
  position: absolute; z-index: 15; top: 36px; inset-inline-end: 0; width: min(220px, calc(100vw - 64px));
  padding: 6px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff;
  box-shadow: 0 18px 42px rgba(15, 38, 58, .18);
}
.community-post-menu[hidden] { display: none; }
.community-post-menu .community-action {
  box-sizing: border-box; width: 100%; min-height: 39px; justify-content: flex-start; gap: 10px;
  border-radius: 6px; padding: 8px 10px; color: #34465a; font-size: 12px; font-weight: 650;
}
.community-post-menu .community-action + .community-action { border-top: 1px solid #edf2f7; border-radius: 0; }
.community-post-menu .community-action:hover { background: #f3f8fc; color: #005ca8; }
.community-post-menu .community-action.delete, .community-post-menu .community-action.remove { color: #dc2626; }
.community-post-menu .community-action.delete:hover, .community-post-menu .community-action.remove:hover { background: #fef2f2; }

.community-actions {
  margin-top: 3px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; min-height: 31px;
}
.community-action-group { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.community-action-primary { min-width: 0; }
.community-action-follow { margin-inline-start: auto; }
.community-action, .community-icon-button, .community-primary, .community-secondary, .community-danger {
  border: 0; font: inherit; cursor: pointer; min-height: 34px; display: inline-flex;
  align-items: center; justify-content: center; gap: 5px;
}
.community-action {
  min-height: 30px; background: transparent; color: #61758b; padding: 4px 7px;
  border-radius: 6px; font-size: 10.5px;
}
.community-action:hover, .community-action.active { background: #e8f5fc; color: #006fb3; }
.community-action.dislike.active { background: #f1f5f9; color: #334155; }
.community-action-icon { width: 17px; min-width: 17px; display: grid; place-items: center; line-height: 1; }
.community-action-icon .community-svg { width: 16px; height: 16px; }
.community-action-label { white-space: nowrap; }
.community-action-count { min-width: 10px; color: inherit; font-size: 10px; font-weight: 750; }
.community-action-primary .like .community-action-label,
.community-action-primary .dislike .community-action-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.community-action-follow .community-action { font-weight: 650; }
.community-action-follow .community-action.active { background: transparent; }
.community-icon-button {
  position: relative; width: 36px; height: 36px; border-radius: 50%; background: #eef6fb; color: #005ca8;
}
.community-icon-button:hover { background: #e1f0fa; }
.community-icon-button .community-svg { width: 18px; height: 18px; }
.community-icon-button.has-unread::after {
  content: ''; position: absolute; top: 3px; inset-inline-end: 3px; width: 7px; height: 7px;
  border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #fff;
}
.community-notification { width: 100%; display: block; text-align: start; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.community-notification.unread { border-inline-start: 3px solid #029fd3; background: #f7fcfe; }
.community-notification.read { color: #64748b; }
.community-notification:hover { border-color: #8bd4ea; }
.community-primary, .community-secondary, .community-danger { border-radius: 6px; padding: 8px 13px; font-size: 12px; font-weight: 750; }
.community-primary { background: #005ca8; color: #fff; }
.community-primary:hover { background: #004f91; }
.community-primary:disabled { opacity: .5; cursor: default; }
.community-secondary { background: #eaf3f9; color: #005ca8; }
.community-danger { background: #fee2e2; color: #b91c1c; }
.community-row-between { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.community-panel { padding: 16px; }
.community-panel + .community-panel { margin-top: 12px; }
.community-panel h4 { margin: 0 0 10px; font-size: 14px; }
.community-gate { max-width: 520px; margin: 28px auto; padding: 24px; text-align: center; }
.community-gate h4 { margin: 10px 0 8px; font-size: 18px; }
.community-gate p { color: #64748b; font-size: 13px; line-height: 1.55; }
.community-empty { padding: 34px 16px; text-align: center; color: #64748b; font-size: 13px; }
.community-status { padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; font-size: 12px; line-height: 1.45; }
.community-status.info { background: #e9f8fd; color: #075985; }
.community-status.warn { background: #fff7ed; color: #9a3412; }
.community-status.error { background: #fef2f2; color: #b91c1c; }
.community-setting-row { padding: 10px 0; border-bottom: 1px solid #edf2f7; }
.community-setting-row:last-child { border-bottom: 0; }
.community-matrix { width: 100%; border-collapse: collapse; font-size: 11px; }
.community-matrix th, .community-matrix td { padding: 7px 4px; border-bottom: 1px solid #edf2f7; text-align: center; }
.community-matrix th:first-child, .community-matrix td:first-child { text-align: start; }
.community-modal-backdrop { position: fixed; inset: 0; z-index: 10050; background: rgba(15,23,42,.5); display: grid; place-items:center; padding: 16px; }
.community-modal { width: min(520px, 100%); max-height: min(88dvh, 760px); overflow-y: auto; background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 20px 55px rgba(15,23,42,.25); }
.community-modal h3 { margin: 0 0 8px; font-size: 18px; }
.community-modal p, .community-modal li { color: #475569; font-size: 12.5px; line-height: 1.5; }
.community-avatar-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin: 10px 0; }
.community-avatar-option { border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; padding: 5px; cursor: pointer; min-width: 0; }
.community-avatar-option .community-avatar { width: 40px; height: 40px; margin: 0 auto; font-size: 13px; }
.community-avatar-option .community-avatar-symbol { font-size: 22px; }
.community-avatar-option.selected { border-color: #029fd3; background: #e9f8fd; }
.community-checkbox { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; font-size: 12px; color: #334155; }
.community-name-state { min-height: 18px; font-size: 11px; margin-top: 4px; color: #64748b; }
.community-name-state.good { color: #15803d; }
.community-name-state.bad { color: #b91c1c; }
.community-suggestions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.community-suggestions button { border: 1px solid #bae6fd; background: #f0f9ff; color: #0369a1; border-radius: 999px; font: inherit; font-size: 10px; padding: 4px 7px; cursor: pointer; }
.community-toast { position: fixed; z-index: 10100; inset-inline-start: 50%; bottom: calc(var(--v4-tabbar-height, 68px) + 18px); transform: translateX(-50%); background: #0f172a; color: #fff; border-radius: 6px; padding: 9px 13px; font-size: 12px; box-shadow: 0 8px 24px rgba(15,23,42,.24); }
.community-svg { display: block; width: 18px; height: 18px; flex: 0 0 auto; }
body.rtl .community-toast { transform: translateX(50%); }

@media (max-width: 480px) {
  #v4SheetCommunity .v4-sheet-header { padding-inline: 15px; }
  .community-sheet-title { gap: 6px; }
  .community-member-count { max-width: 112px; padding-inline: 7px; font-size: 9.5px; }
  .community-header-actions { gap: 4px; }
  .community-header-actions .community-icon-button, #v4SheetCommunity .v4-sheet-close { width: 33px; height: 33px; }
  .community-toolbar { padding: 12px 12px 10px; }
  .community-scroll { padding: 2px 12px 24px; }
  .community-card { padding: 15px 14px 12px; }
  .community-card.reply { margin-inline-start: 12px; }
  .community-card.reply.depth-2 { margin-inline-start: 24px; }
  .community-author-name { max-width: 140px; }
  .community-avatar { width: 38px; height: 38px; flex-basis: 38px; }
  .community-card-header { gap: 7px; }
  .community-pinned-badge { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .community-post-menu { width: min(210px, calc(100vw - 48px)); }
  .community-avatar-picker { grid-template-columns: repeat(4, 1fr); }
  .community-actions { align-items: center; }
  .community-action { padding-inline: 5px; }
  .community-action-follow { margin-inline-start: auto; }
  .v4-tabbar.community-enabled .v4-tab span:not(.v4-tab-pill):not(.community-unread) { font-size: 9px; }
  .v4-tabbar.community-enabled .v4-tab svg { width: 20px; height: 20px; }
}
