/* Community page (#/community). All selectors are prefixed with .com- */

.com-page [hidden] {
  display: none !important;
}

.com-subtitle {
  margin: 4px 0 0;
}

/* ---------- Stats ---------- */

.com-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.com-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.com-stat:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  transform: translateY(-1px);
}

.com-stat:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.com-stat-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 1.25rem;
}

.com-stat-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Tabs, filters, toolbar ---------- */

.com-count {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.com-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.com-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.com-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.com-chip:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.com-chip.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  color: var(--text);
}

.com-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.com-chip-count {
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 0.72rem;
  font-weight: 600;
}

.com-toolbar-right {
  display: flex;
  gap: 8px;
}

.com-search {
  width: 220px;
  max-width: 100%;
}

/* ---------- List & items ---------- */

.com-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.com-skel {
  height: 150px;
  border-radius: var(--radius, 12px);
}

.com-skel-small {
  height: 90px;
  border-radius: 10px;
}

.com-error {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.com-empty-cta {
  display: flex;
  justify-content: center;
  margin-top: -6px;
}

.com-item {
  --tone: var(--info);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-left: 3px solid var(--tone);
  transition: box-shadow 0.15s;
}

.com-item.is-dirty {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), var(--shadow);
}

.com-tone-open { --tone: #5865f2; }
.com-tone-planned { --tone: #9b59b6; }
.com-tone-accepted { --tone: #2ecc71; }
.com-tone-denied { --tone: #e74c3c; }
.com-tone-implemented { --tone: #c9a227; }
.com-tone-confirmed { --tone: #e67e22; }
.com-tone-in_progress { --tone: #3498db; }
.com-tone-fixed { --tone: #2ecc71; }
.com-tone-wontfix { --tone: #95a5a6; }
.com-tone-duplicate { --tone: #95a5a6; }

.com-item-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.com-item-main {
  flex: 1;
  min-width: 0;
}

.com-item-title {
  margin: 0 0 2px;
  font-size: 1rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.com-id {
  color: var(--text-muted);
  font-weight: 500;
}

.com-meta time,
.com-meta span {
  white-space: nowrap;
}

.com-status {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone) 18%, transparent);
  color: color-mix(in srgb, var(--tone) 75%, var(--text));
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.com-status-open { --tone: #5865f2; }
.com-status-planned { --tone: #9b59b6; }
.com-status-accepted { --tone: #2ecc71; }
.com-status-denied { --tone: #e74c3c; }
.com-status-implemented { --tone: #c9a227; }
.com-status-confirmed { --tone: #e67e22; }
.com-status-in_progress { --tone: #3498db; }
.com-status-fixed { --tone: #2ecc71; }
.com-status-wontfix { --tone: #95a5a6; }
.com-status-duplicate { --tone: #95a5a6; }

.com-votes {
  flex: none;
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 10px;
  min-width: 96px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 0.85rem;
}

.com-up strong {
  color: var(--success);
}

.com-down strong {
  color: var(--danger);
}

.com-vote-bar {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--danger) 55%, transparent);
  overflow: hidden;
}

.com-vote-bar.is-empty {
  background: var(--border);
}

.com-vote-bar > span {
  display: block;
  height: 100%;
  background: var(--success);
}

.com-bug-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 1.3rem;
}

.com-desc {
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.com-desc > :first-child {
  margin-top: 0;
}

.com-desc > :last-child {
  margin-bottom: 0;
}

.com-desc.is-clamped {
  max-height: 7.5em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent);
  mask-image: linear-gradient(to bottom, #000 60%, transparent);
}

.com-more {
  align-self: flex-start;
  margin-top: -6px;
}

.com-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.com-fact {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-2);
}

.com-fact dt {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.com-fact dd {
  margin: 2px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.com-bug-desc {
  border: 1px solid var(--border);
  border-radius: 8px;
}

.com-bug-desc > summary {
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
}

.com-bug-desc > .com-desc {
  padding: 0 12px 12px;
}

/* ---------- Editor ---------- */

.com-edit {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.com-edit .field {
  margin: 0;
}

.com-edit textarea {
  min-height: 42px;
  resize: vertical;
}

.com-counter {
  text-align: right;
}

.com-counter.is-over {
  color: var(--danger);
  font-weight: 600;
}

.com-edit-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding-bottom: 20px;
}

.com-dirty {
  color: var(--accent);
  white-space: nowrap;
}

.com-link {
  white-space: nowrap;
}

/* ---------- Channel configuration ---------- */

.com-config > summary {
  list-style: none;
}

.com-config > summary::-webkit-details-marker {
  display: none;
}

.com-config-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
}

.com-config-summary::after {
  content: '▾';
  color: var(--text-muted);
  transition: transform 0.15s;
}

.com-config[open] .com-config-summary::after {
  transform: rotate(180deg);
}

.com-config-summary > span:first-child {
  flex: 1;
}

.com-config-grid {
  margin-top: 12px;
}

.com-config-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.com-config-group legend {
  padding: 0 6px;
  font-weight: 600;
}

.com-config-group .field {
  margin: 0;
}

.com-config-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .com-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .com-edit {
    grid-template-columns: minmax(0, 1fr);
  }

  .com-edit-actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 0;
  }
}

@media (max-width: 700px) {
  .com-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .com-toolbar-right {
    width: 100%;
  }

  .com-search {
    flex: 1;
    width: auto;
  }

  .com-item-top {
    flex-wrap: wrap;
  }

  .com-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .com-edit-actions {
    flex-wrap: wrap;
  }
}
